Component UtilitiesRead With Encoding Method
This is used to read in a file using an appropriate encoding method
Definition
Namespace: Sandcastle.Core
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2026.1.20.0
The contents of the file
Assembly: Sandcastle.Core (in Sandcastle.Core.dll) Version: 2026.1.20.0
C#
public static string ReadWithEncoding(
string filename,
ref Encoding encoding
)VB
Public Shared Function ReadWithEncoding (
filename As String,
ByRef encoding As Encoding
) As StringC++
public:
static String^ ReadWithEncoding(
String^ filename,
Encoding^% encoding
)F#
static member ReadWithEncoding :
filename : string *
encoding : Encoding byref -> string Parameters
- filename String
- The file to load
- encoding Encoding
- Pass the default encoding to use. On return, it contains the actual encoding for the file.
Return Value
StringThe contents of the file
Remarks
When reading the file, it uses the default encoding specified but detects the encoding if
byte order marks are present. In addition, if the template is an XML file and it contains an
encoding identifier in the XML tag, the file is read using that encoding.