C#中的UInt64.ToString()方法与示例
C#中的UInt64.ToString()方法用于将当前UInt64实例的数值转换为其等效的字符串表示形式。
语法
以下是语法-
public override string ToString();
示例
现在让我们看一个实现UInt64.ToString()方法的示例-
using System;
public class Demo {
public static void Main(){
ulong val1 = 465656665;
ulong val2 = 232525678;
Console.WriteLine("Value1 (String representation) = "+val1.ToString());
Console.WriteLine("Value2 (String representation) = "+val2.ToString());
bool res = val1.Equals(val2);
Console.WriteLine("Return value (comparison) = "+res);
if (res)
Console.WriteLine("val1 = val2");
else
Console.WriteLine("val1 != val2");
}
}输出结果
这将产生以下输出-
Value1 (String representation) = 465656665 Value2 (String representation) = 232525678 Return value (comparison) = False val1 != val2
示例
现在让我们来看另一个实现UInt64.ToString()方法的示例-
using System;
public class Demo {
public static void Main(){
ulong val1 = 0;
ulong val2 = UInt64.MaxValue;
Console.WriteLine("Value1 (String representation) = "+val1.ToString());
Console.WriteLine("Value2 (String representation) = "+val2.ToString());
bool res = val1.Equals(val2);
Console.WriteLine("Return value (comparison) = "+res);
if (res)
Console.WriteLine("val1 = val2");
else
Console.WriteLine("val1 != val2");
}
}输出结果
这将产生以下输出-
Value1 (String representation) = 0 Value2 (String representation) = 18446744073709551615 Return value (comparison) = False val1 != val2
热门推荐
10 诗词送行祝福语大全简短
11 新房开工吉日祝福语简短
12 50多岁生日简短祝福语
13 安徽疫情祝福语简短英语
14 农民朋友发财祝福语简短
15 对生活祝福语简短精辟
16 搬家词简短祝福语朋友
17 女神结婚快乐祝福语简短
18 文学短句祝福语大全简短