Sdílet prostřednictvím


ITextTemplatingEngineHost.SetFileExtension – metoda

Sděluje hostiteli očekávaného výstupu generované text přípony.

Obor názvů:  Microsoft.VisualStudio.TextTemplating
Sestavení:  Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 (v Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll)

Syntaxe

'Deklarace
Sub SetFileExtension ( _
    extension As String _
)
void SetFileExtension(
    string extension
)
void SetFileExtension(
    String^ extension
)
abstract SetFileExtension : 
        extension:string -> unit 
function SetFileExtension(
    extension : String
)

Parametry

  • extension
    Typ: System.String
    Přípona názvu souboru pro výstup generovaný text.

Poznámky

Pokud uživatel zadal nepovinný output parametr template směrnice v šabloně text motoru volá metodu. Další informace naleznete v tématu Text šablona směrnic.

Příklady

Následující příklad kódu ukazuje možné provedení vlastního hostitele. Příklad kódu je součástí větší příklad. Pro plný příklad, viz Walkthrough: Vytváření Uživatelský text šablona hostitel.

//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;
}
'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

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

ITextTemplatingEngineHost Rozhraní

Microsoft.VisualStudio.TextTemplating – obor názvů

Další zdroje

Walkthrough: Vytváření Uživatelský text šablona hostitel