Optimizing string.length operations in C# and system source code

  • Thread starter Thread starter zequion1
  • Start date Start date
Z

zequion1

Guest
I do standard functions that check the length of the variables. These functions call other functions that also check the length of the variables.

In the end, to obtain a result, the same checks have been repeated over and over again and I don't want to use global variables to save values is not good and because I would need them for everything.

Having the code:
string A = "123";
If I try this: A [3] = "4" an "Index outside the matrix limits" error occurs.

Questions:
1.- How does the system know the size of the string?

2.- Where can we find the source codes?

3.- I would like to know the source code of IndexOf. I have looked at "Reference Source" but it seems that most of the code is missing because it calls a dll.
Does anyone know where to find it?

Continue reading...
 
Back
Top