CsvFormatAttribute Class

Sets the format string used to write the values of a property or a field, and to read the dates and times.

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public sealed class CsvFormatAttribute : CsvAttribute

Remarks

The values of DateTime, DateTimeOffset, DateOnly, TimeOnly and TimeSpan are read with this exact format. The other values are written with this format and read as usual.

Inheritance
CsvAttribute CsvFormatAttribute

Constructors

NameDescription
CsvFormatAttribute(string)Sets the format string used to write the values of a property or a field, and to read the dates and times.

CsvFormatAttribute(string)

CsvFormatAttribute.cs

Sets the format string used to write the values of a property or a field, and to read the dates and times.

public CsvFormatAttribute(string format)

Parameters

format string
The format string, such as yyyy-MM-dd for a date or F2 for a number.

Remarks

The values of DateTime, DateTimeOffset, DateOnly, TimeOnly and TimeSpan are read with this exact format. The other values are written with this format and read as usual.

Properties

NameDescription
FormatGets the format string.

Gets the format string.

public string Format { get; }

Property value

string