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

extensionWithDot

Glossary Item Box

Creates a temp file having the provided extension

Syntax

Visual Basic (Declaration) 
Public Shared Function FromExtension( _
   ByVal extensionWithDot As String _
) As TempFile
C# 
public static TempFile FromExtension( 
   string extensionWithDot
)

Parameters

extensionWithDot

Example

Library/Library.Test/TestTempFiles.cs

C#Copy Code
using(TempFile a = TempFile.FromExtension(".test"))
{
    a.WriteAllText("a");
    Assert.AreEqual("a", a.ReadAllText());
    Assert.AreEqual(".test", Path.GetExtension(a.TempPath));

    using (TempFile b = TempFile.FromCopy(a.TempPath))
    {
        Assert.AreEqual("a", b.ReadAllText());
        Assert.AreEqual(".test", Path.GetExtension(b.TempPath));
    }
}
VB.NETCopy Code
Using a As TempFile = TempFile.FromExtension(".test")
    a.WriteAllText("a")
    Assert.AreEqual("a", a.ReadAllText())
    Assert.AreEqual(".test", Path.GetExtension(a.TempPath))

    Using b As TempFile = TempFile.FromCopy(a.TempPath)
        Assert.AreEqual("a", b.ReadAllText())
        Assert.AreEqual(".test", Path.GetExtension(b.TempPath))
    End Using
End Using

Requirements

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

See Also

Reference

TempFile Class
TempFile Members

Used By

TestResXtoMc.TestEmptyResXToMc()
TestResXtoMc.TestSimpleStringResXToMc()
TestResXtoMc.TestResXToMcWithCategoryFacilityAndSource()
TestResXtoMc.TestFormatResXToMc()
TestResXtoMc.TestFormatWithSuffixResXToMc()
TestResXtoMc.TestBuildMcFromResX()
TestResXtoMc.TestDuplicateHResult()
TestResXtoMc.TestDuplicateNameInFiles()
TestResXtoMc.TestDuplicateCategorySameIdAndName()
TestResXtoMc.TestDuplicateCategorySameIdDifferentName()
TempFile TempFile.FromCopy(String)

Source Code

Library/IO/TempFile.cs

Generated with Document! X 2011 by Innovasys