How to get ascii value of a char or a string in C# ?
char c= 'y';
int i = c;
byte asciiBytes = Encoding.ASCII.GetBytes(s);
string s= "skill";
int i =(int ) s;
First option is correct for getting ascii value of char and second option is correct for getting ascii values of all characters present in a string.
Third option will give exception since we can not convert data present in a string into integer format using explicit conversion technique.
how we can find ascii value of natural number (0-9)
Back To Top