Updated: November 2007
Tells the host the encoding 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 SetOutputEncoding ( _
encoding As Encoding, _
fromOutputDirective As Boolean _
)
Dim instance As ITextTemplatingEngineHost
Dim encoding As Encoding
Dim fromOutputDirective As Boolean
instance.SetOutputEncoding(encoding, _
fromOutputDirective)
void SetOutputEncoding(
Encoding encoding,
bool fromOutputDirective
)
void SetOutputEncoding(
Encoding^ encoding,
bool fromOutputDirective
)
function SetOutputEncoding(
encoding : Encoding,
fromOutputDirective : boolean
)
Parameters
- encoding
- Type: System.Text..::.Encoding
The encoding for the generated text output.
- fromOutputDirective
- Type: System..::.Boolean
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 that is 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;
}
Private fileEncodingValue As Encoding = Encoding.UTF8
Public ReadOnly Property fileEncoding() As Encoding
Get
Return fileEncodingValue
End Get
End Property
Public Sub SetOutputEncoding(ByVal encoding As System.Text.Encoding, ByVal fromOutputDirective As Boolean) Implements ITextTemplatingEngineHost.SetOutputEncoding
fileEncodingValue = encoding
End Sub
Reference
Other Resources