获取一个值来指示此实例是否等于 C# 中的指定对象或 UInt64
要返回一个值,指示此实例是否等于指定的 object 或 UInt64,代码如下 -
示例
using System; public class Demo { public static void Main() { ulong val1 = 44565777; ulong val2 = 77878787; bool res = val1.Equals(val2); Console.WriteLine("Return value (comparison) = "+res); if (res) Console.WriteLine("val1 = val2"); else Console.WriteLine("val1 != val2"); } }
输出
这将产生以下输出 -
Return value (comparison) = False val1 != val2
示例
让我们看另一个示例 -
using System; public class Demo { public static void Main() { ulong val1 = 78796878; ulong val2 = 78796878; bool res = val1.Equals(val2); Console.WriteLine("Return value (comparison) = "+res); if (res) Console.WriteLine("val1 = val2"); else Console.WriteLine("val1 != val2"); } }
输出
这将产生以下输出 -
Return value (comparison) = True val1 = val2
广告