Accessing each byte of a char

  • Thread starter Thread starter Tim Conner
  • Start date Start date
T

Tim Conner

Is there any method that allows me have access to the individual bytes that
compounds a char variable ?

Regards,
 
Tim,
Have you tried the System.BitConverter.GetBytes method.

It returns a byte array given most built-in types.

Hope this helps
Jay
 
characters in C# are unicode, which means they're 16 bits, rather than 8
bits.

You can access them with array syntax, or with foreach syntax. If you want
to pull out the numeric value, you can then cast to a short or ushort.
 
Back
Top