本文整理匯總了C#中System.UInt32.SequenceEqual方法的典型用法代碼示例。如果您正苦於以下問題:C# UInt32.SequenceEqual方法的具體用法?C# UInt32.SequenceEqual怎麽用?C# UInt32.SequenceEqual使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.UInt32
的用法示例。
在下文中一共展示了UInt32.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);
}