Visual Basic (Declaration) | |
---|---|
Public Shared ReadOnly Int32 As ISerializer(Of Integer) |
C# | |
---|---|
public static readonly ISerializer<int> Int32 |
Library/Library.Test/TestSegmentedStream.cs
C# | Copy Code |
---|---|
using (SharedMemoryStream shared = new SharedMemoryStream()) { shared.Position = ushort.MaxValue - 25; Assert.AreEqual(ushort.MaxValue - 25, shared.Length); Assert.AreEqual(ushort.MaxValue - 25, shared.Position); using (Stream copy = ((IFactory<Stream>) shared).Create()) { Assert.AreEqual(0L, copy.Position);//does not clone position of original stream... Assert.AreEqual(shared.Length, copy.Length);//does clone length of the stream... copy.Position = shared.Position; for (int i = 0; i < 100; i++) { PrimitiveSerializer.Int32.WriteTo(i, shared); Assert.AreEqual(i, PrimitiveSerializer.Int32.ReadFrom(copy)); } } } |
VB.NET | Copy Code |
---|---|
Using [shared] As New SharedMemoryStream() [shared].Position = UShort.MaxValue - 25 Assert.AreEqual(UShort.MaxValue - 25, [shared].Length) Assert.AreEqual(UShort.MaxValue - 25, [shared].Position) Using copy As Stream = (DirectCast([shared], IFactory(Of Stream))).Create() Assert.AreEqual(0L, copy.Position) 'does not clone position of original stream... Assert.AreEqual([shared].Length, copy.Length) 'does clone length of the stream... copy.Position = [shared].Position Dim i As Integer = 0 While i < 100 PrimitiveSerializer.Int32.WriteTo(i, [shared]) Assert.AreEqual(i, PrimitiveSerializer.Int32.ReadFrom(copy)) System.Math.Max(System.Threading.Interlocked.Increment(i),i - 1) End While End Using End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
PrimitiveSerializer ClassPrimitiveSerializer Members
Used By
TransactionLogTestBPlusTreeOptions.TestICloneable()
TestBPlusTreeOptions.TestReadOnly()
TestBPlusTreeOptions.TestCloneWithCallLockV1()
TestBPlusTreeOptions.TestCloneWithCallLockV2()
BasicFileTests.TestRecoverCorruptedFile()
TestMultiInstance.TestSyncFromLogging()
TestTransactionLog.TestTransactionLogOptions()