Click or drag to resize

StringExtensionsConvertToT Method

[This is preliminary documentation and is subject to change.]

Converts a string to a collection of T

Namespace:  CSInfrastructure.Extensions
Assembly:  CSInfrastructure (in CSInfrastructure.dll) Version: 1.13.0+Branch.master.Sha.d583fc64569355d188a9c0818d257b6d0d3e1339
Syntax
C#
public static IEnumerable<T> ConvertTo<T>(
	this string data,
	Func<string, T> convertor,
	char separator = ';'
)

Parameters

data
Type: SystemString
The string containing the data
convertor
Type: SystemFuncString, T
A function that will be executed on each part of the string to convert it to T
separator (Optional)
Type: SystemChar
A separator that separates each item in the string

Type Parameters

T
The type of items in the collection

Return Value

Type: IEnumerableT
A collection of T, which can be empty if conversion fails

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. 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).
See Also