TypeConverter Class |
Namespace: TB.ComponentModel
public class TypeConverter : ITypeConverter, ITypeConversion
The TypeConverter type exposes the following members.
Name | Description | |
---|---|---|
TypeConverter |
Initializes a new instance.
| |
TypeConverter(CultureInfo) |
Initializes a new instance with the given default culture.
|
Name | Description | |
---|---|---|
Conversions |
Gets the list of conversions used by this converter.
| |
DefaultCulture |
Defines the culture which should be used for conversion by default.
Returns CurrentCulture if not set or null.
| |
NullValues |
Gets the collection of return values for conversions that convert from null.
| |
Options |
Gets the conversion options.
| |
ValueMappings |
Gets the list of mappings of specific source values to specific return values.
The list is implemented as 'Last In – First Out' (LIFO).
|
Name | Description | |
---|---|---|
CanConvert |
Determines whether the given value can be converted to the specified type.
| |
CanConvertToT |
Determines whether the given value can be converted to the specified type.
| |
Convert |
Converts the given value to the given type.
| |
ConvertToT |
Converts the given value to the given type.
| |
ConvertToEnumerable(IEnumerable, Type, CultureInfo) |
Returns an iterator over the results of converting the given values to the given type.
The conversion is configurable further more before iteration.
| |
ConvertToEnumerableT(IEnumerable, CultureInfo) |
Returns an iterator over the results of converting the given values to the given type.
The conversion is configurable further more before iteration.
| |
Create(Type, IDictionaryString, Object, CultureInfo) |
Creates a new instance of the given type by mapping the key value pairs of the given dictionary to constructor parameters, public properties and public fields of the given type.
Throws an InstantiationException if creation failed.
For success, at least on key value pair must be used as a constructor parameter, public property or public field.
If the dictionary contains only one key value pair, its value is returned if it is exactly of the demanded type.
| |
CreateT(IDictionaryString, Object, CultureInfo) |
Creates a new instance of the given type by mapping the key value pairs of the given dictionary to constructor parameters, public properties and public fields of the given type.
Throws an InstantiationException if creation failed.
For success, at least on key value pair must be used as a constructor parameter, public property or public field.
If the dictionary contains only one key value pair, its value is returned if it is exactly of the demanded type.
| |
CreateDataTableT |
Creates a DataTable from an IEnumerable{T}.
Each element of the given source results in a row representing the properties of {T} as columns.
| |
TryConvert |
Converts the given value to the given type.
A return value indicates whether the operation succeeded.
| |
TryConvertToT |
Converts the given value to the given type.
A return value indicates whether the operation succeeded.
| |
TryCreate(Type, IDictionaryString, Object, Object, CultureInfo) |
Creates a new instance of the given type by mapping the key value pairs of the given dictionary to constructor parameters, public properties and public fields of the given type.
Returns true if creation succeeded. For success, at least on key value pair must be used as a constructor parameter, public property or public field.
If the dictionary contains only one key value pair, its value is returned if it is exactly of the demanded type.
| |
TryCreateT(IDictionaryString, Object, T, CultureInfo) |
Creates a new instance of the given type by mapping the key value pairs of the given dictionary to constructor parameters, public properties and public fields of the given type.
Returns true if creation succeeded. For success, at least on key value pair must be used as a constructor parameter, public property or public field.
If the dictionary contains only one key value pair, its value is returned if it is exactly of the demanded type.
|
Name | Description | |
---|---|---|
AsT |
Converts the given value to the given type using the default converter.
The result provides access to the converted value if conversion succeeded and simplifies access to default values if conversion failed.
(Defined by ObjectExtension.) | |
IsConvertibleTo(Type, CultureInfo) | Overloaded.
Determines whether the given value can be converted to the specified type using the default converter.
(Defined by ObjectExtension.) | |
IsConvertibleTo(Type, Object, CultureInfo) | Overloaded.
Converts the given value to the given type using the default converter.
A return value indicates whether the operation succeeded.
(Defined by ObjectExtension.) | |
IsConvertibleToT(CultureInfo) | Overloaded.
Determines whether the given value can be converted to the specified type using the default converter.
(Defined by ObjectExtension.) | |
IsConvertibleToT(T, CultureInfo) | Overloaded.
Converts the given value to the given type using the default converter.
A return value indicates whether the operation succeeded.
(Defined by ObjectExtension.) | |
To(Type, CultureInfo) | Overloaded.
Converts the given value to the given type using the default converter.
(Defined by ObjectExtension.) | |
ToT(CultureInfo) | Overloaded.
Converts the given value to the given type using the default converter.
(Defined by ObjectExtension.) | |
ToDictionary |
Creates a new dictionary whose key value pairs represent all non static public values of the given source.
If source is null, an empty dictionary is created.
If source has no non static public properties or fields (eg. int), the dictionary contains only one key named "Value" representing the given value itself.
(Defined by ObjectExtension.) |