public static CsvReader<TResult> OpenRead<TResult>(
string filePath,
CsvTo<TResult> converter,
char delimiter = ',',
Encoding? textEncoding = null,
bool isHeaderPresent = true,
CsvOpts options = CsvOpts.Default
)
Public Shared Function OpenRead(Of TResult) (
filePath As String,
converter As CsvTo(Of TResult),
Optional delimiter As Char = ","C,
Optional textEncoding As Encoding = Nothing,
Optional isHeaderPresent As Boolean = true,
Optional options As CsvOpts = CsvOpts.Default
) As CsvReader(Of TResult)
public:
generic<typename TResult>
static CsvReader<TResult>^ OpenRead(
String^ filePath,
CsvTo<TResult>^ converter,
wchar_t delimiter = L',',
Encoding^ textEncoding = nullptr,
bool isHeaderPresent = true,
CsvOpts options = CsvOpts::Default
)
static member OpenRead :
filePath : string *
converter : CsvTo<'TResult> *
?delimiter : char *
?textEncoding : Encoding *
?isHeaderPresent : bool *
?options : CsvOpts
(* Defaults:
let _delimiter = defaultArg delimiter ','
let _textEncoding = defaultArg textEncoding null
let _isHeaderPresent = defaultArg isHeaderPresent true
let _options = defaultArg options CsvOpts.Default
*)
-> CsvReader<'TResult>
The optimal parameters can be determined automatically with AnalyzeFile(String, Encoding, Header, Int32) - or use OpenReadAnalyzedTResult(String, CsvMapping, FuncObject, TResult, Encoding, Header, Int32).
When importing CSV data from Excel, the appropriate arguments can be determined with GetExcelArguments.
ArgumentNullException | filePath or converter is null. |
ArgumentException | filePath is not a valid file path. |
ArgumentOutOfRangeException | delimiter is either the double quotes " or a line break character ('\r' or '\n'). |
IOException | I/O error. |