TypeConverterExtensionToIEnumerableConverterTItem Method
Namespace: FolkerKinzel.CsvTools.MappingsAssembly: FolkerKinzel.CsvTools.Mappings (in FolkerKinzel.CsvTools.Mappings.dll) Version: 1.1.0+1263e8243dc2cd78095f678f813d7d9c52ea4315
public static TypeConverter<IEnumerable<TItem>?> ToIEnumerableConverter<TItem>(
this TypeConverter<TItem> itemsConverter,
string separator,
bool nullable = true
)
<ExtensionAttribute>
Public Shared Function ToIEnumerableConverter(Of TItem) (
itemsConverter As TypeConverter(Of TItem),
separator As String,
Optional nullable As Boolean = true
) As TypeConverter(Of IEnumerable(Of TItem))
public:
[ExtensionAttribute]
generic<typename TItem>
static TypeConverter<IEnumerable<TItem>^>^ ToIEnumerableConverter(
TypeConverter<TItem>^ itemsConverter,
String^ separator,
bool nullable = true
)
[<ExtensionAttribute>]
static member ToIEnumerableConverter :
itemsConverter : TypeConverter<'TItem> *
separator : string *
?nullable : bool
(* Defaults:
let _nullable = defaultArg nullable true
*)
-> TypeConverter<IEnumerable<'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 EmptyTResult as
DefaultValue.
- TItem
- The Type of the items of the
IEnumerableT objects that the newly created converter can convert.
TypeConverterIEnumerableTItem
A new
TypeConverterT instance that converts
IEnumerableT.
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.