本文整理汇总了C#中NumberFormatInfo.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# NumberFormatInfo.GetHashCode方法的具体用法?C# NumberFormatInfo.GetHashCode怎么用?C# NumberFormatInfo.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NumberFormatInfo
的用法示例。
在下文中一共展示了NumberFormatInfo.GetHashCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PosTest1
public bool PosTest1()
{
bool retVal = true;
// Add your scenario description here
TestLibrary.TestFramework.BeginScenario("PosTest1: Verify method Clone .");
try
{
NumberFormatInfo nfi1 = new NumberFormatInfo();
NumberFormatInfo nfi2 = (NumberFormatInfo)nfi1.Clone();
if (!nfi1.Equals(nfi2) && nfi1.GetHashCode() == nfi2.GetHashCode())
{
TestLibrary.TestFramework.LogError("001.1", "Method Clone Err .");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
示例2: Clone
public void Clone()
{
NumberFormatInfo format = new NumberFormatInfo();
format.CurrencyDecimalSeparator = "string";
NumberFormatInfo clone = (NumberFormatInfo)format.Clone();
Assert.NotEqual(format.GetHashCode(), clone.GetHashCode());
Assert.NotEqual(format, clone);
Assert.NotSame(format, clone);
Assert.Equal(format.CurrencyDecimalDigits, clone.CurrencyDecimalDigits);
Assert.Equal(format.CurrencyDecimalSeparator, clone.CurrencyDecimalSeparator);
Assert.Equal(format.CurrencyGroupSizes, clone.CurrencyGroupSizes);
Assert.Equal(format.CurrencyGroupSeparator, clone.CurrencyGroupSeparator);
Assert.Equal(format.CurrencyNegativePattern, clone.CurrencyNegativePattern);
Assert.Equal(format.CurrencyPositivePattern, clone.CurrencyPositivePattern);
Assert.Equal(format.IsReadOnly, clone.IsReadOnly);
}