EncodingHelper.GetEncoding Method
Determines the encoding of the specified file from its byte order mark.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.12.0 (in Microsoft.VisualStudio.TextTemplating.12.0.dll)
'Declaration
Public Shared Function GetEncoding ( _
filePath As String _
) As Encoding
public static Encoding GetEncoding(
string filePath
)
public:
static Encoding^ GetEncoding(
String^ filePath
)
static member GetEncoding :
filePath:string -> Encoding
public static function GetEncoding(
filePath : String
) : Encoding
filePath
Type: System.StringThe file to determine the encoding of.
Type: System.Text.Encoding
An Encoding that contains the encoding information. The default is Default, the current ANSI code page of the system.
Exception | Condition |
---|---|
ArgumentNullException | filePath is nulla null reference (Nothing in Visual Basic). |
When a user creates a text template, they can specify the encoding that they want the text template host to use to create the generated text. If the user does not specify the encoding, the host calls this method to determine the encoding of the text template. The host can then use the same encoding to create the generated text.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Microsoft.VisualStudio.TextTemplating Namespace
Code Generation and T4 Text Templates