本文整理汇总了C#中SerializationInfo.GetInt64方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetInt64方法的具体用法?C# SerializationInfo.GetInt64怎么用?C# SerializationInfo.GetInt64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetInt64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: runTest
//.........这里部分代码省略.........
strValue = "Int16_" + i;
serinfo1.AddValue(strValue, i16Value);
iCountTestcases++;
if(serinfo1.GetInt16(strValue)!= i16Value)
{
iCountErrors++;
Console.WriteLine("Err_0267fe_" + i + "! Wrong value returned, " + serinfo1.GetInt16(strValue));
}
}
Console.WriteLine("Int32 ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_015643ds_" + i;
i32Value = (int)(Int32.MaxValue * rnd1.NextDouble());
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);
示例2: ParameterBindingException
/// <summary>
/// Constructors a ParameterBindingException using serialized data.
/// </summary>
///
/// <param name="info">
/// serialization information
/// </param>
///
/// <param name="context">
/// streaming context
/// </param>
protected ParameterBindingException(
SerializationInfo info,
StreamingContext context)
: base(info, context)
{
_message = info.GetString("ParameterBindingException_Message");
_parameterName = info.GetString("ParameterName");
_line = info.GetInt64("Line");
_offset = info.GetInt64("Offset");
}