Use the Convert.ToUInt64() method to convert a specified value to a 64-bit unsigned integer.
The following is our char.
char ch = 'a';
Now, let’s convert it to a 64-bit unsigned integer.
ulong res; res = Convert.ToUInt64(ch);
Here is the complete example.
Example
using System;
public class Demo {
public static void Main() {
char ch = 'a';
ulong res;
res = Convert.ToUInt64(ch);
Console.WriteLine("Converted char value '{0}' to {1}", ch, res);
}
}Output
Converted char value 'a' to 97