本文整理汇总了C#中System.UInt16.SequenceEqual方法的典型用法代码示例。如果您正苦于以下问题:C# UInt16.SequenceEqual方法的具体用法?C# UInt16.SequenceEqual怎么用?C# UInt16.SequenceEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.UInt16
的用法示例。
在下文中一共展示了UInt16.SequenceEqual方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeArrays
public void SerializeArrays()
{
// Write data -------------------------------------
var arrayUInt16 = new UInt16[] { 0, 900, 32000 };
_serializer.Writer.WriteUInt16Array(arrayUInt16);
AssertBytesWritten(8);
var arrayUInt32 = new UInt32[] { 0, 900, 32000 };
_serializer.Writer.WriteUInt32Array(arrayUInt32);
AssertBytesWritten(14);
var arrayInt16 = new Int16[] { -700, 0, 32000 };
_serializer.Writer.WriteInt16Array(arrayInt16);
AssertBytesWritten(8);
var arrayInt32 = new Int32[] { -700, 0, 32000 };
_serializer.Writer.WriteInt32Array(arrayInt32);
AssertBytesWritten(14);
var arrayInt64 = new Int64[] { -700, 0, 32000 };
_serializer.Writer.WriteInt64Array(arrayInt64);
AssertBytesWritten(26);
_serializer.Writer.WriteUInt16Array(null); AssertBytesWritten(1);
_serializer.Writer.WriteUInt32Array(null); AssertBytesWritten(1);
_serializer.Writer.WriteInt16Array(null); AssertBytesWritten(1);
_serializer.Writer.WriteInt32Array(null); AssertBytesWritten(1);
_serializer.Writer.WriteInt64Array(null); AssertBytesWritten(1);
// Message end
_serializer.Writer.Internal.WriteDataUInt(Bms1Tag.MessageEnd, 0);
AssertBytesWritten(1);
// Read and verify data ----------------------------------------
_stream.Position = 0;
_serializer.Reader.Internal.ReadAttributes();
Assert.IsTrue(arrayUInt16.SequenceEqual(_serializer.Reader.ReadUInt16Array()));
Assert.IsTrue(arrayUInt32.SequenceEqual(_serializer.Reader.ReadUInt32Array()));
Assert.IsTrue(arrayInt16.SequenceEqual(_serializer.Reader.ReadInt16Array()));
Assert.IsTrue(arrayInt32.SequenceEqual(_serializer.Reader.ReadInt32Array()));
Assert.IsTrue(arrayInt64.SequenceEqual(_serializer.Reader.ReadInt64Array()));
Assert.IsNull(_serializer.Reader.ReadUInt16Array());
Assert.IsNull(_serializer.Reader.ReadUInt32Array());
Assert.IsNull(_serializer.Reader.ReadInt16Array());
Assert.IsNull(_serializer.Reader.ReadInt32Array());
Assert.IsNull(_serializer.Reader.ReadInt64Array());
// Message end
Assert.IsTrue(_serializer.Reader.Internal.EndOfBlock);
}