Table of Contents

Interface IConversionService

Namespace
Steeltoe.Common.Converter
Assembly
Steeltoe.Common.Abstractions.dll

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

sourceType Type

the source type

targetType Type

the target type

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

sourceType Type

the type of the source object

targetType Type

the type of the target object

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 object

the object to convert; may be null

sourceType Type

the source objects type

targetType Type

the 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 object

the source object to convert

Returns

T

the converted object

Type Parameters

T

the target type to convert to