本文整理汇总了C#中NumberFormatInfo.GetFormat方法的典型用法代码示例。如果您正苦于以下问题:C# NumberFormatInfo.GetFormat方法的具体用法?C# NumberFormatInfo.GetFormat怎么用?C# NumberFormatInfo.GetFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NumberFormatInfo
的用法示例。
在下文中一共展示了NumberFormatInfo.GetFormat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PosTest2
public bool PosTest2()
{
bool retVal = true;
// Add your scenario description here
TestLibrary.TestFramework.BeginScenario("PosTest2: Verify method GetFormat when arg is not a type of NumberFormatInfo .");
try
{
NumberFormatInfo nfi = new NumberFormatInfo();
Type formatType = typeof(object);
if (nfi.GetFormat(formatType) != null)
{
TestLibrary.TestFramework.LogError("002.1", "Failed to instance a NumberFormatInfo type .");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("002.2", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
示例2: PosTest1
public bool PosTest1()
{
bool retVal = true;
// Add your scenario description here
TestLibrary.TestFramework.BeginScenario("PosTest1: Verify method GetFormat when arg is a type of NumberFormatInfo .");
try
{
NumberFormatInfo nfi = new NumberFormatInfo();
Type formatType = typeof(NumberFormatInfo);
object obj = nfi.GetFormat(formatType);
bool testVerify = obj is NumberFormatInfo;
if (testVerify != true)
{
TestLibrary.TestFramework.LogError("001.1", "Method GetFormat .");
retVal = false;
}
}
catch (Exception e)
{
TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
TestLibrary.TestFramework.LogInformation(e.StackTrace);
retVal = false;
}
return retVal;
}
示例3: GetFormat_InvalidType
public void GetFormat_InvalidType()
{
NumberFormatInfo format = new NumberFormatInfo();
Assert.Null(format.GetFormat(typeof(object)));
}
示例4: GetFormat_NumberFormatInfo
public void GetFormat_NumberFormatInfo()
{
NumberFormatInfo format = new NumberFormatInfo();
Assert.Same(format, format.GetFormat(typeof(NumberFormatInfo)));
}