TypeConverterExtensionToListConverterTItem Method
Creates a new
ListT converter instance.
Namespace: FolkerKinzel.CsvTools.MappingsAssembly: FolkerKinzel.CsvTools.Mappings (in FolkerKinzel.CsvTools.Mappings.dll) Version: 1.1.0+1263e8243dc2cd78095f678f813d7d9c52ea4315
public static TypeConverter<List<TItem>?> ToListConverter<TItem>(
this TypeConverter<TItem> itemsConverter,
string separator,
bool nullable = true
)
<ExtensionAttribute>
Public Shared Function ToListConverter(Of TItem) (
itemsConverter As TypeConverter(Of TItem),
separator As String,
Optional nullable As Boolean = true
) As TypeConverter(Of List(Of TItem))
public:
[ExtensionAttribute]
generic<typename TItem>
static TypeConverter<List<TItem>^>^ ToListConverter(
TypeConverter<TItem>^ itemsConverter,
String^ separator,
bool nullable = true
)
[<ExtensionAttribute>]
static member ToListConverter :
itemsConverter : TypeConverter<'TItem> *
separator : string *
?nullable : bool
(* Defaults:
let _nullable = defaultArg nullable true
*)
-> TypeConverter<List<'TItem>>
- itemsConverter TypeConverterTItem
- A TypeConverterT instance that converts the items.
- separator String
- A String that separates the items in a field of the CSV file.
When parsing the CSV, separator will not be part of the results.
- nullable Boolean (Optional)
- true to set DefaultValue
to null; false to have an empty ListT as
DefaultValue.
- TItem
- The Type of the items of the ListT
objects that the newly created converter can convert.
TypeConverterListTItem
A new
TypeConverterT instance that converts
ListT. The value of its
Throwing property is derived from
itemsConverter.
In Visual Basic and C#, you can call this method as an instance method on any object of type
TypeConverterTItem. 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).
The converter the method creates uses a simple string split and join operation. For nested CSV better
use a simple
StringConverter and initialize a separate
CsvReader,
CsvWriter, and
CsvMapping to handle the nested items.