EncodingHelper.GetEncoding Method
Determines the encoding of the specified file from its byte order mark.
Namespace: Microsoft.VisualStudio.TextTemplating
Assembly: Microsoft.VisualStudio.TextTemplating.11.0 (in Microsoft.VisualStudio.TextTemplating.11.0.dll)
Syntax
'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
Parameters
filePath
Type: StringThe file to determine the encoding of.
Return Value
Type: Encoding
An Encoding that contains the encoding information. The default is Default, the current ANSI code page of the system.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | filePath is nulla null reference (Nothing in Visual Basic). |
Remarks
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.
.NET Framework Security
- 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.
See Also
Reference
Microsoft.VisualStudio.TextTemplating Namespace
Other Resources
Code Generation and T4 Text Templates