Tip
Use AnalyzeFile(String, Encoding, Header, Int32) to also automatically
determine the Encoding.
public static CsvAnalyzerResult AnalyzeFile(
string filePath,
Encoding? textEncoding = null,
Header header = Header.ProbablyPresent,
int analyzedLines = 5
)
Public Shared Function AnalyzeFile (
filePath As String,
Optional textEncoding As Encoding = Nothing,
Optional header As Header = Header.ProbablyPresent,
Optional analyzedLines As Integer = 5
) As CsvAnalyzerResult
public:
static CsvAnalyzerResult^ AnalyzeFile(
String^ filePath,
Encoding^ textEncoding = nullptr,
Header header = Header::ProbablyPresent,
int analyzedLines = 5
)
static member AnalyzeFile :
filePath : string *
?textEncoding : Encoding *
?header : Header *
?analyzedLines : int
(* Defaults:
let _textEncoding = defaultArg textEncoding null
let _header = defaultArg header Header.ProbablyPresent
let _analyzedLines = defaultArg analyzedLines 5
*)
-> CsvAnalyzerResult
The text encoding to be used to read the CSV file, or null for UTF8.
CsvAnalyzer performs a statistical analysis on the CSV file to find the appropriate method arguments for reading the file. The result of the analysis is therefore always only an estimate, the accuracy of which increases with the number of lines analyzed. The analysis is time-consuming because the CSV file has to be accessed for reading.
The field delimiters COMMA (',', %x2C), SEMICOLON (';', %x3B), HASH ('#', %x23), TAB ('\t', %x09), and SPACE (' ', %x20) are recognized automatically.
Use AnalyzeFile(String, Encoding, Header, Int32) to analyze the textEncoding too.
ArgumentNullException | filePath is null. |
ArgumentOutOfRangeException | header is not a defined value of the Header enum. - or - header is a combination of Header values. |
ArgumentException | filePath is not a valid file path. |
IOException | I/O error. |