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

Glossary Item Box

Open or Create the temporary file for reading and writing

Syntax

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

Example

Library/Library.Test/TestTempFiles.cs

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

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

Stream o = file.Open();
Assert.IsTrue(o.CanWrite);
Assert.IsTrue(o.CanRead);

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

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

Dim o As Stream = file.Open()
Assert.IsTrue(o.CanWrite)
Assert.IsTrue(o.CanRead)

o.Dispose()
r.Dispose()
file.Dispose()

Requirements

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

See Also

Reference

TempFile Class
TempFile Members

Used By

BasicFileTests.TestRecoverCorruptedFile()
TestResXtoMcByProject.TestGenerateWin32Resource()
TestResXtoMcByProject.TestProjectResXVersionByAssembly()
TestResXtoMcByProject.TestProjectResXWithBadAssemblyInfo()

Source Code

Library/IO/TempFile.cs

Generated with Document! X 2011 by Innovasys