In the case of sb.Append(2), the compiler is picking the overload
StringBuilder Append (int value);
If you want the "2" to be treated as the ASCII value of the character, you
want it to pick the overload
StringBuilder Append (char value);
Try this:
sb.Append ((char) 2);
-vJ
"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:uK**************@TK2MSFTNGP12.phx.gbl...
Hi
I am construncting a string containing some control chars (STX/ETX)
I noticed that adding a byte with value 2 is the same as adding a
character
'2' ???
How can i solve this problem ?
Is the stringbuilder restricted to pure readable ascii code contents ?
sb.Append(2); // ascii code 2
sb.Append('2'); // ascii char '2'
Johan