Attaches a new instances of a TempFile to the provided directory path
Syntax
Example
Library/Library.Test/TestTempFiles.cs
C# | Copy Code |
---|
string path;
using (TempDirectory d = new TempDirectory())
{
Assert.IsTrue(Directory.Exists(d.TempPath));
path = d.Detatch();
}
Assert.IsTrue(Directory.Exists(path));
using (TempDirectory d = TempDirectory.Attach(path))
{
Assert.IsTrue(Directory.Exists(path));
}
Assert.IsFalse(Directory.Exists(path)); |
VB.NET | Copy Code |
---|
Dim path As String
Using d As New TempDirectory()
Assert.IsTrue(Directory.Exists(d.TempPath))
path = d.Detatch()
End Using
Assert.IsTrue(Directory.Exists(path))
Using d As TempDirectory = TempDirectory.Attach(path)
Assert.IsTrue(Directory.Exists(path))
End Using
Assert.IsFalse(Directory.Exists(path)) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also