Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual Studio SDK
 SetFileExtension Method

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Domain-Specific Language Tools Reference
ITextTemplatingEngineHost..::.SetFileExtension Method

Updated: November 2007

Tells the host the file name extension that is expected for the generated text output.

Namespace:  Microsoft.VisualStudio.TextTemplating
Assembly:  Microsoft.VisualStudio.TextTemplating (in Microsoft.VisualStudio.TextTemplating.dll)

Visual Basic (Declaration)
Sub SetFileExtension ( _
    extension As String _
)
Visual Basic (Usage)
Dim instance As ITextTemplatingEngineHost
Dim extension As String

instance.SetFileExtension(extension)
C#
void SetFileExtension(
    string extension
)
Visual C++
void SetFileExtension(
    String^ extension
)
JScript
function SetFileExtension(
    extension : String
)

Parameters

extension
Type: System..::.String

The file name extension for the generated text output.

If the user has specified the optional output parameter of the template directive in a text template, the engine calls this method. For more information, see Directive Syntax (Domain-Specific Languages).

The following code example shows a possible implementation for a custom host. This code example is part of a larger example that is provided for the ITextTemplatingEngineHost interface.

C#
//the host can provide a default by setting the value of the field here
private string fileExtensionValue = ".txt";
public string FileExtension
{
    get { return fileExtensionValue; }
}

public void SetFileExtension(string extension)
{
    //the parameter extension has a '.' in front of it already
    //--------------------------------------------------------
    fileExtensionValue = extension;
}
Visual Basic
'the host can provide a default by setting the value of the field here
Private fileExtensionValue As String = ".txt"
        Public ReadOnly Property FileExtension() As String
            Get
                Return fileExtensionValue
            End Get
        End Property

Public Sub SetFileExtension(ByVal extension As String) Implements Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.SetFileExtension

    'the parameter extension has a '.' in front of it already
    '--------------------------------------------------------
    fileExtensionValue = extension
End Sub
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker