HOW CAN I GET THE ASCII CODE FOR A CHARACTER IN C#?

Mahesh Rawat

Total Post:138

Points:690
Posted by  Mahesh Rawat
C# 
C#
 1278  View(s)
Ratings:
Rate this:
  1. Mahesh Rawat

    Post:138

    Points:690
    How can I get the ASCII code for a character in C#?

    Casting the char to an int will give you the ASCII value: char c = 'f';

    System.Console.WriteLine((int)c);

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!