本文整理汇总了C#中SerializationInfo.GetSByte方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetSByte方法的具体用法?C# SerializationInfo.GetSByte怎么用?C# SerializationInfo.GetSByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetSByte方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: runTest
//.........这里部分代码省略.........
if(serinfo1.GetChar(strValue)!= chValue)
{
iCountErrors++;
Console.WriteLine("Err_65730dsw_" + i + "! Wrong Char returned, " + serinfo1.GetChar(strValue));
}
}
try {
iCountTestcases++;
serinfo1.AddValue("Char_1", 'a');
iCountErrors++;
Console.WriteLine("Err_643cd! Exception not thrown");
}catch(SerializationException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_02457fd! Wrong exception thrown, " + ex);
}
try {
iCountTestcases++;
serinfo1.AddValue("Boolean_1", 'a');
iCountErrors++;
Console.WriteLine("Err_5732fcd! Exception not thrown");
}catch(SerializationException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_024568fd! Wrong exception thrown, " + ex);
}
Console.WriteLine("SByte ticks, " + Environment.TickCount);
for(int i=(int)SByte.MinValue; i<(int)SByte.MaxValue; i++) {
strLoc="Loc_56473vd_" + i;
sbtValue = (SByte)i;;
strValue = "SByte_" + i;
serinfo1.AddValue(strValue, sbtValue);
iCountTestcases++;
if(serinfo1.GetSByte(strValue)!= sbtValue)
{
iCountErrors++;
Console.WriteLine("Err_4627fds_" + i + "! Wrong Sbyte returned, " + serinfo1.GetSByte(strValue));
}
}
Console.WriteLine("Byte ticks, " + Environment.TickCount);
for(int i=(int)Byte.MinValue; i<(int)Byte.MaxValue; i++) {
strLoc="Loc_01192ds_" + i;
btValue = (Byte)i;;
strValue = "Byte_" + i;
serinfo1.AddValue(strValue, btValue);
iCountTestcases++;
if(serinfo1.GetByte(strValue)!= btValue)
{
iCountErrors++;
Console.WriteLine("Err_0267fe_" + i + "! Wrong byte returned, " + serinfo1.GetByte(strValue));
}
}
Console.WriteLine("Int16 ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_012965565ds_" + i;
i16Value = (short)((int)Int16.MaxValue * rnd1.NextDouble());
if(rnd1.NextDouble()<0.5)
i16Value = (short)(-1 * i16Value);
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));
}