Convert.ToUInt64 Method in C#


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

 Live Demo

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

Updated on: 23-Jun-2020

119 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements