本文整理汇总了C#中SerializationInfo.GetUInt16方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetUInt16方法的具体用法?C# SerializationInfo.GetUInt16怎么用?C# SerializationInfo.GetUInt16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetUInt16方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: runTest
//.........这里部分代码省略.........
if(rnd1.NextDouble()<0.5)
i32Value = (-1 * i32Value);
strValue = "Int32_" + i;
serinfo1.AddValue(strValue, i32Value);
iCountTestcases++;
if(serinfo1.GetInt32(strValue)!= i32Value)
{
iCountErrors++;
Console.WriteLine("Err_5427ds_" + i + "! Wrong value returned, " + serinfo1.GetInt32(strValue));
}
}
Console.WriteLine("Int64 ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_625bfg_" + i;
i64Value = (long)((long)Int64.MaxValue * rnd1.NextDouble());
if(rnd1.NextDouble()<0.5)
i64Value = (long)(-1 * i64Value);
strValue = "Int64_" + i;
serinfo1.AddValue(strValue, i64Value);
iCountTestcases++;
if(serinfo1.GetInt64(strValue)!= i64Value)
{
iCountErrors++;
Console.WriteLine("Err_6427dc_" + i + "! Wrong value returned, " + serinfo1.GetInt64(strValue));
}
}
Console.WriteLine("UInt16 ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_6473cd_" + i;
ui16Value = (ushort)((int)UInt16.MaxValue * rnd1.NextDouble());
strValue = "UInt16_" + i;
serinfo1.AddValue(strValue, ui16Value);
iCountTestcases++;
if(serinfo1.GetUInt16(strValue)!= ui16Value)
{
iCountErrors++;
Console.WriteLine("Err_748vd_" + i + "! Wrong value returned, " + serinfo1.GetUInt16(strValue));
}
}
Console.WriteLine("UInt32 ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_7573cd_" + i;
ui32Value = (uint)(UInt32.MaxValue * rnd1.NextDouble());
strValue = "UInt32_" + i;
serinfo1.AddValue(strValue, ui32Value);
iCountTestcases++;
if(serinfo1.GetUInt32(strValue)!= ui32Value)
{
iCountErrors++;
Console.WriteLine("Err_4738cd_" + i + "! Wrong value returned, " + serinfo1.GetUInt32(strValue));
}
}
Console.WriteLine("UInt64 ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_63dc_" + i;
ui64Value = (ulong)(UInt64.MaxValue * rnd1.NextDouble());
strValue = "UInt64_" + i;
serinfo1.AddValue(strValue, ui64Value);
iCountTestcases++;
if(serinfo1.GetUInt64(strValue)!= ui64Value)
{
iCountErrors++;
Console.WriteLine("Err_6583fd_" + i + "! Wrong value returned, " + serinfo1.GetUInt64(strValue));
}
}
Console.WriteLine("Double ticks, " + Environment.TickCount);