Out of curiosity I am trying to determine string length without using properties or methods, this is something that works in C, but still kind of new to this concept of \0
.
From what I understood, and I am talking about C, this character is something that is automatically put after setting value to some string, so that it could be determined how much space is needed for storage, but how does this works in C#?
string str = "someText";
int lenght = 0;
while (str[lenght]!='\0')
{
lenght++;
}
Console.WriteLine(str);
Console.WriteLine("String lenght is : "+ lenght);
Console.ReadLine();