Getting an ascii value from a byte

J

James Dean

i want to be able to get the correct ascii value from a byte without
having to use the Convert.ToChar function as a char takes up two bytes
of space and it is affecting the performance of my program. I know that
for example the char value 'R' is '82' in byte form. What i want is to
be able to translate byte numbers to their ascii equivalent quickly and
easily(e.g."54 is 6 in ascii code") with as little processing as
possible......
 
S

Shiva

Hi,
Just cast the number (or the byte value) to char type as in
Console.WriteLine ((char)82);

i want to be able to get the correct ascii value from a byte without
having to use the Convert.ToChar function as a char takes up two bytes
of space and it is affecting the performance of my program. I know that
for example the char value 'R' is '82' in byte form. What i want is to
be able to translate byte numbers to their ascii equivalent quickly and
easily(e.g."54 is 6 in ascii code") with as little processing as
possible......
 

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

Top