David,
> string's in C# are NOT null termintated. You should never have a null
char
> in a string in C# or VB, and it's actually pretty hard to get one in
there.
You do need null char in C#, VB6, & VB.NET strings when you are calling
Win32 APIs. As some Win32 APIs use a single null char as a seperator and
double null chars as a terminator.
Also, some external communication (TCP/IP, comm ports) may need null chars
in the middle of the string being transmitted...
It is actually rather nice that .NET Strings fully support null chars, as a
null char is still a valid character. Its just some of the interop stuff
chokes (debugger, System.Console, System.Diagnostics.Debug,
System.Diagnostics.Trace) when displayed in VS.NET especially.
Just a thought
Jay
"David Browne" <davidbaxterbrowne no potted
(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>
> "Nikhil Patel" <(E-Mail Removed)> wrote in message
> news:O%(E-Mail Removed)...
> > Ok.
> > now I get it. The string in C# works in C++ way. I am a VB
programmer.
> > So forgot about null terminator. But I am wondering even in C++, when
you
> > use "+" to concat strings, doesn't it get rid of the null terminators of
> all
> > strings except the last one?
> >
>
> No a string in C# is exactly like a string in VB. Internally it is a
fixed
> length array of chars.
> There is no need for a null terminator, since the array has a length.
>
> string's in C# are NOT null termintated. You should never have a null
char
> in a string in C# or VB, and it's actually pretty hard to get one in
there.
>
> If you do manage to get a null char into a string, some things don't work
> quite right.
>
> It's just the only thing I could think of which would cause your
> concatenation to fail.
>
> David
>
>