本文整理汇总了C#中IBinaryReader.ReadIntArray方法的典型用法代码示例。如果您正苦于以下问题:C# IBinaryReader.ReadIntArray方法的具体用法?C# IBinaryReader.ReadIntArray怎么用?C# IBinaryReader.ReadIntArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBinaryReader
的用法示例。
在下文中一共展示了IBinaryReader.ReadIntArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadBinary
public void ReadBinary(IBinaryReader reader)
{
Assert.AreEqual(1, reader.ReadByte("Byte"));
Assert.AreEqual(new byte[] {1}, reader.ReadByteArray("ByteArray"));
Assert.AreEqual('1', reader.ReadChar("Char"));
Assert.AreEqual(new[] {'1'}, reader.ReadCharArray("CharArray"));
Assert.AreEqual(1, reader.ReadShort("Short"));
Assert.AreEqual(new short[] {1}, reader.ReadShortArray("ShortArray"));
Assert.AreEqual(1, reader.ReadInt("Int"));
Assert.AreEqual(new[] {1}, reader.ReadIntArray("IntArray"));
Assert.AreEqual(1, reader.ReadLong("Long"));
Assert.AreEqual(new long[] {1}, reader.ReadLongArray("LongArray"));
Assert.AreEqual(true, reader.ReadBoolean("Boolean"));
Assert.AreEqual(new[] {true}, reader.ReadBooleanArray("BooleanArray"));
Assert.AreEqual(1, reader.ReadFloat("Float"));
Assert.AreEqual(new float[] {1}, reader.ReadFloatArray("FloatArray"));
Assert.AreEqual(1, reader.ReadDouble("Double"));
Assert.AreEqual(new double[] {1}, reader.ReadDoubleArray("DoubleArray"));
Assert.AreEqual(1, reader.ReadDecimal("Decimal"));
Assert.AreEqual(new decimal?[] {1}, reader.ReadDecimalArray("DecimalArray"));
Assert.AreEqual(Date, reader.ReadTimestamp("Timestamp"));
Assert.AreEqual(new DateTime?[] {Date}, reader.ReadTimestampArray("TimestampArray"));
Assert.AreEqual("1", reader.ReadString("String"));
Assert.AreEqual(new[] {"1"}, reader.ReadStringArray("StringArray"));
Assert.AreEqual(Guid, reader.ReadGuid("Guid"));
Assert.AreEqual(new Guid?[] {Guid}, reader.ReadGuidArray("GuidArray"));
Assert.AreEqual(MyEnum.Bar, reader.ReadEnum<MyEnum>("Enum"));
Assert.AreEqual(new[] {MyEnum.Bar}, reader.ReadEnumArray<MyEnum>("EnumArray"));
var raw = reader.GetRawReader();
Assert.AreEqual(1, raw.ReadByte());
Assert.AreEqual(new byte[] { 1 }, raw.ReadByteArray());
Assert.AreEqual('1', raw.ReadChar());
Assert.AreEqual(new[] { '1' }, raw.ReadCharArray());
Assert.AreEqual(1, raw.ReadShort());
Assert.AreEqual(new short[] { 1 }, raw.ReadShortArray());
Assert.AreEqual(1, raw.ReadInt());
Assert.AreEqual(new[] { 1 }, raw.ReadIntArray());
Assert.AreEqual(1, raw.ReadLong());
Assert.AreEqual(new long[] { 1 }, raw.ReadLongArray());
Assert.AreEqual(true, raw.ReadBoolean());
Assert.AreEqual(new[] { true }, raw.ReadBooleanArray());
Assert.AreEqual(1, raw.ReadFloat());
Assert.AreEqual(new float[] { 1 }, raw.ReadFloatArray());
Assert.AreEqual(1, raw.ReadDouble());
Assert.AreEqual(new double[] { 1 }, raw.ReadDoubleArray());
Assert.AreEqual(1, raw.ReadDecimal());
Assert.AreEqual(new decimal?[] { 1 }, raw.ReadDecimalArray());
Assert.AreEqual(Date, raw.ReadTimestamp());
Assert.AreEqual(new DateTime?[] { Date }, raw.ReadTimestampArray());
Assert.AreEqual("1", raw.ReadString());
Assert.AreEqual(new[] { "1" }, raw.ReadStringArray());
Assert.AreEqual(Guid, raw.ReadGuid());
Assert.AreEqual(new Guid?[] { Guid }, raw.ReadGuidArray());
Assert.AreEqual(MyEnum.Bar, raw.ReadEnum<MyEnum>());
Assert.AreEqual(new[] { MyEnum.Bar }, raw.ReadEnumArray<MyEnum>());
}
示例2: ReadBinary
/** <inheritDoc /> */
public void ReadBinary(IBinaryReader reader)
{
Byte = reader.ReadByte("Byte");
ByteArray = reader.ReadByteArray("ByteArray");
Char = reader.ReadChar("Char");
CharArray = reader.ReadCharArray("CharArray");
Short = reader.ReadShort("Short");
ShortArray = reader.ReadShortArray("ShortArray");
Int = reader.ReadInt("Int");
IntArray = reader.ReadIntArray("IntArray");
Long = reader.ReadLong("Long");
LongArray = reader.ReadLongArray("LongArray");
Boolean = reader.ReadBoolean("Boolean");
BooleanArray = reader.ReadBooleanArray("BooleanArray");
Float = reader.ReadFloat("Float");
FloatArray = reader.ReadFloatArray("FloatArray");
Double = reader.ReadDouble("Double");
DoubleArray = reader.ReadDoubleArray("DoubleArray");
Decimal = reader.ReadDecimal("Decimal");
DecimalArray = reader.ReadDecimalArray("DecimalArray");
Date = reader.ReadTimestamp("Date");
DateArray = reader.ReadTimestampArray("DateArray");
String = reader.ReadString("String");
StringArray = reader.ReadStringArray("StringArray");
Guid = reader.ReadObject<Guid>("Guid");
GuidArray = reader.ReadGuidArray("GuidArray");
}