H
Herfried K. Wagner [MVP]
Jay,
I have played around with that too and I got the same results. As
expected, the strings will be visually terminated at the null character,
but I didn't find any place inside the IDE which showed the wrong
/length/ (the number of characters, not the characters) of the string or
the string builder, respectively.
* "Jay B. Harlow said:Both System.String & System.Text.StringBuilder fully support having a null
char in the string.
ACK.
If sb.length = 1920, then sb.tostring.length should also be 1920!
I know the debugger in VS.NET has troubles with null chars in strings as it
relies on Win32 APIs that treat the null char as a string terminator,
however it is an API problem not a String or StringBuilder problem. Also
System.Console & System.Diagnostics.Debug & Trace will have problems, as
they all rely on a Win32 API that treat the null char as a string
terminator...
I have played around with that too and I got the same results. As
expected, the strings will be visually terminated at the null character,
but I didn't find any place inside the IDE which showed the wrong
/length/ (the number of characters, not the characters) of the string or
the string builder, respectively.