本文整理汇总了C#中System.IO.BinaryReader.ReadSByte方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.BinaryReader.ReadSByte方法的具体用法?C# System.IO.BinaryReader.ReadSByte怎么用?C# System.IO.BinaryReader.ReadSByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryReader
的用法示例。
在下文中一共展示了System.IO.BinaryReader.ReadSByte方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public static Row Deserialize(byte[] bytes)
{
using (System.IO.MemoryStream MS = new System.IO.MemoryStream (bytes, false)) {
using (System.IO.BinaryReader BR = new System.IO.BinaryReader (MS)) {
byte[] columnSet = BR.ReadBytes (32);
int FieldCount = BR.ReadInt32 ();
object[] fields = new object[FieldCount];
ColumnSet cs = css [columnSet];
if (cs.Columns.Length != fields.Length)
throw new Exception ();
for (int n = 0; n != fields.Length; n++) {
bool Null = BR.ReadBoolean ();
if (Null) {
fields [n] = null;
continue;
}
switch (cs.Columns [n].TFQN) {
case "System.Byte[]":
fields [n] = BR.ReadBytes (BR.ReadInt32 ());
break;
case "System.Byte":
fields [n] = BR.ReadByte ();
break;
case "System.SByte":
fields [n] = BR.ReadSByte ();
break;
case "System.Int16":
fields [n] = BR.ReadInt16 ();
break;
case "System.UInt16":
fields [n] = BR.ReadUInt16 ();
break;
case "System.Int32":
fields [n] = BR.ReadInt32 ();
break;
case "System.UInt32":
fields [n] = BR.ReadUInt32 ();
break;
case "System.Int64":
fields [n] = BR.ReadInt64 ();
break;
case "System.UInt64":
fields [n] = BR.ReadUInt64 ();
break;
case "System.Single":
fields [n] = BR.ReadSingle ();
break;
case "System.Double":
fields [n] = BR.ReadDouble ();
break;
case "System.String":
fields [n] = BR.ReadString ();
break;
case "System.Char":
fields [n] = BR.ReadChar ();
break;
case "System.Boolean":
fields [n] = BR.ReadBoolean ();
break;
case "System.DateTime":
fields [n] = new DateTime (BR.ReadInt64 ());
break;
case "System.Guid":
fields [n] = new Guid (BR.ReadBytes (16));
break;
}
}
return new Row (cs, fields);
}
}
}