Interface IConversionService
A service interface for type conversions.
public interface IConversionService
Methods
CanBypassConvert(Type, Type)
Determine whether the conversion between source type and destination type can be bypassed.
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.
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.
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
T Convert<T>(object source)
Parameters
sourceobjectthe source object to convert
Returns
- T
the converted object
Type Parameters
Tthe target type to convert to