Visual Basic (Declaration) | |
---|---|
Public Function New() |
C# | |
---|---|
public SegmentedMemoryStream() |
Library/Library.Test/TestSegmentedStream.cs
C# | Copy Code |
---|---|
using (SegmentedMemoryStream ms = new SegmentedMemoryStream()) { Assert.AreEqual(0L, ms.Length); Assert.AreEqual(0L, ms.Position); Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Begin)); Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Current)); Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.End)); ms.Position = 42L; Assert.AreEqual(42L, ms.Length); Assert.AreEqual(42L, ms.Position); Assert.AreEqual(42L, ms.Seek(42, System.IO.SeekOrigin.Begin)); Assert.AreEqual(42L, ms.Seek(0, System.IO.SeekOrigin.Current)); Assert.AreEqual(42L, ms.Seek(0, System.IO.SeekOrigin.End)); ms.Position = 0; Assert.AreEqual(0L, ms.Position); Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Begin)); Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Current)); Assert.AreEqual(0L, ms.Seek(-42, System.IO.SeekOrigin.End)); } |
VB.NET | Copy Code |
---|---|
Using ms As New SegmentedMemoryStream() Assert.AreEqual(0L, ms.Length) Assert.AreEqual(0L, ms.Position) Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Begin)) Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Current)) Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.[End])) ms.Position = 42L Assert.AreEqual(42L, ms.Length) Assert.AreEqual(42L, ms.Position) Assert.AreEqual(42L, ms.Seek(42, System.IO.SeekOrigin.Begin)) Assert.AreEqual(42L, ms.Seek(0, System.IO.SeekOrigin.Current)) Assert.AreEqual(42L, ms.Seek(0, System.IO.SeekOrigin.[End])) ms.Position = 0 Assert.AreEqual(0L, ms.Position) Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Begin)) Assert.AreEqual(0L, ms.Seek(0, System.IO.SeekOrigin.Current)) Assert.AreEqual(0L, ms.Seek(-42, System.IO.SeekOrigin.[End])) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7