On 25 Jul., 10:45, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
You should be *very* clear about the differences between characters
and bytes. In .NET, each char is represented as *two* bytes (a UTF-16
code point).
Now, if you mean you've got an integer that you want to be converted
into a byte array and then treated as ASCII text, you can use
BitConverter to go from the integer to a byte array, then
Encoding.ASCII to go from the byte array to text.
Jon
usually i'm aware about the difference - anyway thank's for the
casting conclusion.
so: yes, i meant ASCII text and i've made a small method for my prob:
<code>
private string IntToString(int intVal)
{
byte[] bVal = BitConverter.GetBytes(intVal);
System.Text.ASCIIEncoding asciiEncoding = new
System.Text.ASCIIEncoding();
return asciiEncoding.GetString(bVal);
}
</code>
work's great - thank's for the thought-provoking impulse :)