Visual Basic (Declaration) | |
---|---|
Public Function New( _ ByVal filename As String, _ ByVal mode As FileMode _ ) |
Parameters
- filename
- mode
Library/Library.Test/TestStreamCache.cs
C# | Copy Code |
---|---|
Stream stream; using (TempFile tempFile = new TempFile()) { using (StreamCache cache = new StreamCache(new FileStreamFactory(tempFile.TempPath, FileMode.Open))) { using (stream = cache.Open()) { stream.SetLength(100); stream.WriteByte(1); } } Assert.AreEqual(100, tempFile.Length); using (stream = tempFile.Open()) Assert.AreEqual(1, stream.ReadByte()); } |
VB.NET | Copy Code |
---|---|
Dim stream As Stream Using tempFile As New TempFile() Using cache As New StreamCache(New FileStreamFactory(tempFile.TempPath, FileMode.Open)) Using stream = cache.Open() stream.SetLength(100) stream.WriteByte(1) End Using End Using Assert.AreEqual(100, tempFile.Length) Using stream = tempFile.Open() Assert.AreEqual(1, stream.ReadByte()) End Using End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
FileStreamFactory ClassFileStreamFactory Members
Overload List