CSVSettings Class

/// Settings to configure how a CSV file is parsed ///
Public Class CSVSettings
This language is not supported or no code example is available.
public class CSVSettings
This language is not supported or no code example is available.
public ref class CSVSettings 
This language is not supported or no code example is available.
public class CSVSettings
This language is not supported or no code example is available.
Name Description
Public property AllowNull /// Set this value to true to allow nulls to be rendered in CSV files when serializing /// and deserializing. /// /// CSV files by default do not have a mechanism for differentiating between null fields /// and empty fields. If this field is set to false, both `null` and empty string will /// render as an empty string. /// /// If this field is set to true, all non-null fields will be enclosed by the text qualifier, /// and fields that are null will be represented as `NullToken`. ///
Public property AllowSepLine /// When reading a CSV file, if the first line contains the instruction `sep=`, use this /// to determine the separator for the file. /// /// The "sep" line is a feature exclusive to Microsoft Excel, which permits CSV files to /// more easily handle European files where the comma character is often a separator between /// numeric values rather than a field delimiter. /// /// If this flag is set to true, when you parse a CSV, the first line of the parsing can override /// the field separator logic for each individual instance of parsing, but it will not change /// the `FieldDelimiter` in your settings object. /// /// More information: /// * [Original Issue Report](https://github.com/tspence/csharp-csv-reader/issues/28) /// * [Superuser Article](https://superuser.com/questions/773644/what-is-the-sep-metadata-you-can-add-to-csvs) /// * [Tjitjing Blog](https://blog.tjitjing.com/index.php/2016/07/set-separator-delimiter-in-csv-file-to-open-correctly-in-excel.html) ///
Public property AssumedHeaders /// If `HeaderRowIncluded` is false, use these values for the headers ///
Public property BufferSize /// When reading data from a stream, this is the block size to read at once. ///
Public property DateTimeFormat /// The format to use for serializing date time objects, by default, ISO 8601 ///
Public property Encoding /// The encoding for converting streams of bytes to strings ///
Public property ExcludedColumns /// Exclude these columns during serialization and deserialization ///
Public property FieldDelimiter /// The character used to delimit individual fields in the CSV. ///
Public property ForceQualifierTypes /// A list of data types that require text qualifiers during serialization. ///
Public property ForceQualifiers /// Set this value to true to enclose all fields in the text qualifier character. ///
Public property HeaderRowIncluded /// The first line of the CSV file will include the names of each field. ///
Public property HeadersCaseSensitive /// Expect headers to be case sensitive during deserialization ///
Public property IgnoreDimensionErrors /// Set this value to true to allow parsing for files where each row has a different number of fields ///
Public property IgnoreEmptyLineForDeserialization /// Some CSV files contain an empty line at the end. If you set this flag to true, deserialization will /// not throw an error for empty lines and will instead ignore it. ///
Public property IgnoreHeaderErrors /// Set this value to true to ignore header errors when deserializing ///
Public property IgnoreReadOnlyProperties /// Set this flag to true to ignore read-only properties during serialization ///
Public property LineSeparator /// The separator used to indicate the end of a line in the CSV file. ///
Public property NestedArrayBehavior /// The behavior to use when serializing a column that is an array or enumerable type ///
Public property NestedObjectBehavior /// The behavior to use when serializing a column that is a class ///
Public property NullToken /// If AllowNull is set to true, this token will be used to represent NULL values. ///
Public property TextQualifier /// The character used to enclose fields that contain the delimiter character. ///
Top
Methods
 
Name Description
Public method CloneWithNewDelimiter(char) /// Clone the existing settings, but with a different field delimiter. /// /// Used for parsing of "sep=" lines so that the original object is immutable. ///
Public method GetForceQualifierTypes() /// Retrieve a hashset containing the list of types that require text qualifiers, or null if this /// feature is not used in this settings definition ///
Public method GetRiskyChars() /// Retrieve the list of risky characters according to this settings definition ///
Top
Fields
 
Name Description
Public field Static CSV /// Standard comma-separated value (CSV) file settings ///
Public field Static CSV_PERMIT_NULL /// Standard comma-separated value (CSV) file settings that permit rendering of NULL values ///
Public field Static TSV /// Standard tab-separated value (TSV) file settings ///
Top

.NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

In this article

Definition