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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top