Click or drag to resize

TypeConverter Class

Defines a type converter.
Inheritance Hierarchy
SystemObject
  TB.ComponentModelTypeConverter

Namespace:  TB.ComponentModel
Assembly:  UniversalTypeConverter (in UniversalTypeConverter.dll) Version: 2.0.0
Syntax
C#
public class TypeConverter : ITypeConverter, 
	ITypeConversion

The TypeConverter type exposes the following members.

Constructors
  NameDescription
Public methodTypeConverter
Initializes a new instance.
Public methodTypeConverter(CultureInfo)
Initializes a new instance with the given default culture.
Top
Properties
  NameDescription
Public propertyConversions
Gets the list of conversions used by this converter.
Public propertyDefaultCulture
Defines the culture which should be used for conversion by default. Returns CurrentCulture if not set or null.
Public propertyNullValues
Gets the collection of return values for conversions that convert from null.
Public propertyOptions
Gets the conversion options.
Public propertyValueMappings
Gets the list of mappings of specific source values to specific return values. The list is implemented as 'Last In – First Out' (LIFO).
Top
Methods
  NameDescription
Public methodCanConvert
Determines whether the given value can be converted to the specified type.
Public methodCanConvertToT
Determines whether the given value can be converted to the specified type.
Public methodConvert
Converts the given value to the given type.
Public methodConvertToT
Converts the given value to the given type.
Public methodConvertToEnumerable(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.
Public methodConvertToEnumerableT(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.
Public methodCreate(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.
Public methodCreateT(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.
Public methodCreateDataTableT
Creates a DataTable from an IEnumerable{T}. Each element of the given source results in a row representing the properties of {T} as columns.
Public methodTryConvert
Converts the given value to the given type. A return value indicates whether the operation succeeded.
Public methodTryConvertToT
Converts the given value to the given type. A return value indicates whether the operation succeeded.
Public methodTryCreate(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.
Public methodTryCreateT(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.
Top
Extension Methods
  NameDescription
Public Extension MethodAsT
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.)
Public Extension MethodIsConvertibleTo(Type, CultureInfo)Overloaded.
Determines whether the given value can be converted to the specified type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodIsConvertibleTo(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.)
Public Extension MethodIsConvertibleToT(CultureInfo)Overloaded.
Determines whether the given value can be converted to the specified type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodIsConvertibleToT(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.)
Public Extension MethodTo(Type, CultureInfo)Overloaded.
Converts the given value to the given type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodToT(CultureInfo)Overloaded.
Converts the given value to the given type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodToDictionary
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.)
Top
See Also