CsvConstantAttribute(object)
Added in v34.0.0
public CsvConstantAttribute(object? value)Gives the member value in every record.
Parameters
valueobject?- The value of the member.
Attribute in CsvHelper
Gives a member of a CsvRecordAttribute type a fixed value instead of reading a column: every record read gets Value, and the record writer writes it in the member's column, whatever the member holds.
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter)]
public sealed class CsvConstantAttribute : AttributeCsvHelperCsvHelper.dllThe value must be a constant that converts implicitly to the member's type, or null for a reference type or a Nullable<T>. The header does not need the column. The column's other attributes, such as its name and CsvColumnAttribute.Index, still say where the record writer writes it.
public CsvConstantAttribute(object? value)Gives the member value in every record.
valueobject?public object? Value { get; }The value of the member.