Class GenericConversionService
public class GenericConversionService : IConversionService, IConverterRegistry
- Inheritance
-
GenericConversionService
- Implements
- Derived
- Inherited Members
Methods
AddConverter(IGenericConverter)
Adds a generic converter to this registry
public void AddConverter(IGenericConverter converter)
Parameters
converterIGenericConverterthe converter to add
CanBypassConvert(Type, Type)
Determine whether the conversion between source type and destination type can be bypassed.
public bool CanBypassConvert(Type sourceType, Type targetType)
Parameters
Returns
- bool
returns true if it can be bypassed
CanConvert(Type, Type)
Returns true if objects of the source type can be converted to the target type.
public bool CanConvert(Type sourceType, Type targetType)
Parameters
Returns
- bool
returns true if the conversion can be performed
Convert(object, Type, Type)
Convert the given source to the specified target type.
public object Convert(object source, Type sourceType, Type targetType)
Parameters
sourceobjectthe object to convert; may be null
sourceTypeTypethe source objects type
targetTypeTypethe target type to convert to
Returns
- object
the converted object
Convert<T>(object)
Convert the given source to the target
public T Convert<T>(object source)
Parameters
sourceobjectthe source object to convert
Returns
- T
the converted object
Type Parameters
Tthe target type to convert to
GetConverter(Type, Type)
protected virtual IGenericConverter GetConverter(Type sourceType, Type targetType)
Parameters
Returns
GetDefaultConverter(Type, Type)
protected virtual IGenericConverter GetDefaultConverter(Type sourceType, Type targetType)