Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

วิธี Convert.ToUInt64 ใน C #


ใช้วิธี Convert.ToUInt64() เพื่อแปลงค่าที่ระบุเป็นจำนวนเต็ม 64 บิตที่ไม่ได้ลงนาม

ต่อไปนี้เป็นอักขระของเรา

char ch = 'a';

ตอนนี้ มาแปลงเป็นจำนวนเต็ม 64 บิตที่ไม่มีเครื่องหมาย

ulong res;
res = Convert.ToUInt64(ch);

นี่คือตัวอย่างที่สมบูรณ์

ตัวอย่าง

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);
   }
}

ผลลัพธ์

Converted char value 'a' to 97