本文整理汇总了C#中SerializationInfo.GetByte方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetByte方法的具体用法?C# SerializationInfo.GetByte怎么用?C# SerializationInfo.GetByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetByte方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Message
public Message(SerializationInfo info, StreamingContext context)
{
SourceID = info.GetInt32 ("SourceID");
DestID = info.GetInt32 ("DestID");
Type = (MessageType)info.GetByte ("MessageType");
SerializedContent = (byte[])info.GetValue ("SerializedContent", typeof(byte[]));
}
示例2: GameplayMessage
public GameplayMessage(SerializationInfo info, StreamingContext context)
{
Message = (MessageValue)info.GetByte ("Message");
PlayerID = info.GetInt32 ("PlayerID");
MoveDelta = new Vector2((float)info.GetValue("x",typeof(float)),(float)info.GetValue("y",typeof(float)));
OldPosition = new Vector3((float)info.GetValue("xloc", typeof(float)), (float)info.GetValue("yloc", typeof(float)), (float)info.GetValue("zloc", typeof(float)));
}
示例3: runTest
//.........这里部分代码省略.........
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));
}
}
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++;
示例4: NetworkMessage
public NetworkMessage(SerializationInfo info, StreamingContext context)
{
Message = (MessageValue)info.GetByte ("Message");
}