Methods | TryDetectTextFileEncoding Method
Detects and returns the encoding of a text file. A return value indicates the detection was likely successful.
Syntax
C# Copy
public static bool TryDetectTextFileEncoding( string filePath, out Encoding fileEncoding )
Parameters
filePath String
The path of the text file to detect encoding.
fileEncoding Encoding
When this method returns, contains the detected encoding. If the detection was not successful, the fileEncoding parameter will be null.
Return Value
Booleantrue if the encoding was likely detected successfully; otherwise, false.