C# 中的 Convert.ToUInt64 方法
csharpprogrammingserver side programming
使用 Convert.ToUInt64() 方法将指定值转换为 64 位无符号整数。
以下是我们的 char。
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("将 char 值 '{0}' 转换为 {1}", ch, res); } }
输出
将 char 值 'a' 转换为 97