Export (0) Print
Expand All

ITextTemplatingEngineHost.SetOutputEncoding Method

Tells the host the encoding expected for the generated text output.

Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating (in microsoft.visualstudio.texttemplating.dll)

void SetOutputEncoding (
	Encoding encoding,
	bool fromOutputDirective
)
void SetOutputEncoding (
	Encoding encoding, 
	boolean fromOutputDirective
)
function SetOutputEncoding (
	encoding : Encoding, 
	fromOutputDirective : boolean
)

Parameters

encoding

The encoding for the generated text output file.

fromOutputDirective

true to indicate that the user specified the encoding in the encoding parameter of the output directive.

The engine calls this method if the user has specified the optional encoding parameter of the template directive in a text template. 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 provided for the ITextTemplatingEngineHost interface.

private Encoding fileEncodingValue = Encoding.UTF8;
public Encoding FileEncoding
{
    get { return fileEncodingValue; }
}

public void SetOutputEncoding(System.Text.Encoding encoding, bool fromOutputDirective)
{
    fileEncodingValue = encoding;
}

Community Additions

ADD
Show:
© 2015 Microsoft