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
source
objectthe object to convert; may be null
sourceType
Typethe source objects type
targetType
Typethe 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
source
objectthe source object to convert
Returns
- T
the converted object
Type Parameters
T
the target type to convert to