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
相关用法
- C# UInt64.ToString()方法用法及代码示例
- C# UInt64.Equals用法及代码示例
- C# UInt64.GetHashCode用法及代码示例
- C# UInt64.MinValue用法及代码示例
- C# UInt64.GetTypeCode()用法及代码示例
- C# UInt64.GetTypeCode用法及代码示例
- C# UInt64.Parse(String)用法及代码示例
- C# UInt64.MaxValue用法及代码示例
- C# UInt64.CompareTo()用法及代码示例
- C# UInt64.GetHashCode()用法及代码示例
- C# UInt32.GetHashCode()用法及代码示例
- C# UInt16.MaxValue用法及代码示例
- C# UInt16.Equals用法及代码示例
- C# UInt16.GetTypeCode用法及代码示例
- C# UInt16.GetTypeCode()用法及代码示例
- C# UInt16.ToString用法及代码示例
- C# UInt32.CompareTo()用法及代码示例
- C# UInt16.GetHashCode()用法及代码示例
- C# UInt32.MinValue用法及代码示例
- C# UInt32.ToString()用法及代码示例
注:本文由纯净天空筛选整理自AmitDiwan大神的英文原创作品 UInt64.ToString() Method in C# with Examples。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。