CsvRecordExtensionFillWith(CsvRecord, IEnumerableObject, IFormatProvider, String, Boolean) Method

Fills record with the items of an IEnumerable.

Definition

Namespace: FolkerKinzel.CsvTools
Assembly: FolkerKinzel.CsvTools (in FolkerKinzel.CsvTools.dll) Version: 2.0.1+2345335399184346d9b2cc992ed5c814406052c1
C#
public static void FillWith(
	this CsvRecord record,
	IEnumerable<Object> data,
	IFormatProvider formatProvider = null,
	string format = null,
	bool resetExcess = true
)

Parameters

record  CsvRecord
The CsvRecord instance to be filled.
data  IEnumerableObject
The Objects with which to fill record. The argument may be null or may contain null values.
formatProvider  IFormatProvider  (Optional)

The provider to use to format the value.

- or -

A null reference for InvariantCulture.

format  String  (Optional)

A format String to use for all items that implement IFormattable.

- or -

A null reference to use the default format for each item.

resetExcess  Boolean  (Optional)

If data has fewer items than record fields and this parameter is true, the surplus fields in record will be reset to the default value .

For performance reasons this parameter can be set to false when writing CSV because WriteRecord resets all fields in record.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type CsvRecord. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

For serialization ToString(String, IFormatProvider) is used if the item implements IFormattable, otherwise ToString.

Exceptions

ArgumentNullExceptionrecord is null.
ArgumentOutOfRangeExceptiondata contains more items than record.

See Also