1.

How Can I Get The Ascii Code For A Character In C#?

Answer»

Casting the char to an int will give you the ASCII value: char c = 'f';
System.Console.WriteLine((int)c); or for a CHARACTER in a string:
System.Console.WriteLine((int)s[3]);
The BASE CLASS libraries also OFFER ways to do this with the Convert class or Encoding CLASSES if you need a particular encoding.

Casting the char to an int will give you the ASCII value: char c = 'f';
System.Console.WriteLine((int)c); or for a character in a string:
System.Console.WriteLine((int)s[3]);
The base class libraries also offer ways to do this with the Convert class or Encoding classes if you need a particular encoding.



Discussion

No Comment Found