Class CsvDataReader
Provides a way of reading a forward-only stream of rows from a CSV based data source. This class cannot be inherited.
Implements
Inherited Members
Namespace: Cuemon.Data.CsvClient
Assembly: Cuemon.Data.dll
Syntax
public sealed class CsvDataReader : StringDataReader, IEnumerable, IDataReader, IDataRecord, IDisposable
Constructors
| Improve this DocCsvDataReader(StreamReader, String)
Initializes a new instance of the CsvDataReader class.
Declaration
public CsvDataReader(StreamReader reader, string header)
Parameters
Type | Name | Description |
---|---|---|
System.IO.StreamReader | reader | The System.IO.StreamReader object that contains the CSV data. |
System.String | header | The header defining the columns of the CSV data. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.ArgumentNullException |
|
ArgumentEmptyException |
|
CsvDataReader(StreamReader, String, String)
Initializes a new instance of the CsvDataReader class.
Declaration
public CsvDataReader(StreamReader reader, string header, string delimiter)
Parameters
Type | Name | Description |
---|---|---|
System.IO.StreamReader | reader | The System.IO.StreamReader object that contains the CSV data. |
System.String | header | The header defining the columns of the CSV data. |
System.String | delimiter | The delimiter specification. |
Remarks
The default implementation uses comma (",") as delimiter
.
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.ArgumentNullException |
|
ArgumentEmptyException |
|
CsvDataReader(StreamReader, String, String, Func<String, Object>)
Initializes a new instance of the CsvDataReader class.
Declaration
public CsvDataReader(StreamReader reader, string header, string delimiter, Func<string, object> parser)
Parameters
Type | Name | Description |
---|---|---|
System.IO.StreamReader | reader | The System.IO.StreamReader object that contains the CSV data. |
System.String | header | The header defining the columns of the CSV data. |
System.String | delimiter | The delimiter specification. |
System.Func<System.String, System.Object> | parser | The function delegate that returns a primitive object whose value is equivalent to the provided System.String value. |
Remarks
The default implementation uses FromString(String) as parser
.
Exceptions
Type | Condition |
---|---|
System.ArgumentException |
|
System.ArgumentNullException |
|
ArgumentEmptyException |
|
Properties
| Improve this DocDelimiter
Gets the delimiter used to separate fields of this instance.
Declaration
public string Delimiter { get; }
Property Value
Type | Description |
---|---|
System.String | The delimiter used to separate fields of this instance. |
HasRows
Gets a value that indicates whether this System.Data.Common.DbDataReader contains one or more rows.
Declaration
public override bool HasRows { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Overrides
Header
Gets the header that defines the field names of this instance.
Declaration
public string[] Header { get; }
Property Value
Type | Description |
---|---|
System.String[] | The header that defines the field names of this instance. |
Methods
| Improve this DocDispose(Boolean)
Releases unmanaged and - optionally - managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
|
Overrides
| Improve this DocReadNext()
Advances this instance to the next line of the CSV data source.
Declaration
protected override bool ReadNext()
Returns
Type | Description |
---|---|
System.Boolean |
|