CSharpTest.Net
Create Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.IO Namespace > TempFile Class : Create Method

Glossary Item Box

Re-Creates and Opens the temporary file for writing, multiple calls will truncate existing data.

Syntax

Visual Basic (Declaration) 
Public Function Create() As Stream
C# 
public Stream Create()

Example

Library/Library.Test/TestTempFiles.cs

C#Copy Code
TempFile file = new TempFile();

Stream c = file.Create();
Assert.IsTrue(c.CanWrite);
Assert.IsFalse(c.CanRead);

Stream r = file.Read();
Assert.IsFalse(r.CanWrite);
Assert.IsTrue(r.CanRead);

c.Dispose();
r.Dispose();
file.Dispose();
VB.NETCopy Code
Dim file As New TempFile()

Dim c As Stream = file.Create()
Assert.IsTrue(c.CanWrite)
Assert.IsFalse(c.CanRead)

Dim r As Stream = file.Read()
Assert.IsFalse(r.CanWrite)
Assert.IsTrue(r.CanRead)

c.Dispose()
r.Dispose()
file.Dispose()

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys