C# Class DeftTech.DuckTyping.DelegateDuckCaster

Duck casting strategy used to cast two delegate types.
Inheritance: IDuckCaster
显示文件 Open project: deftflux/DuckTyping

Public Methods

Method Description
CanCast ( Type toType, Type fromType ) : bool
Cast ( Type toType, object duck ) : object
CouldUncast ( Type originalType, Type castedType ) : bool
PrepareCast ( Type toType, Type fromType ) : void
ShouldCast ( Type toType, Type fromType ) : bool
ShouldUncast ( object duck ) : bool
Uncast ( object duck ) : object

Private Methods

Method Description
DelegateDuckCaster ( ) : System

Initializes static members.

GetProxyType ( Type toType, Type fromType ) : DelegateDuckProxyType

Gets the DelegateDuckProxyType object for a given duck type.

Method Details

CanCast() public method

public CanCast ( Type toType, Type fromType ) : bool
toType System.Type
fromType System.Type
return bool

Cast() public method

public Cast ( Type toType, object duck ) : object
toType System.Type
duck object
return object

CouldUncast() public method

public CouldUncast ( Type originalType, Type castedType ) : bool
originalType System.Type
castedType System.Type
return bool

PrepareCast() public method

public PrepareCast ( Type toType, Type fromType ) : void
toType System.Type
fromType System.Type
return void

ShouldCast() public method

public ShouldCast ( Type toType, Type fromType ) : bool
toType System.Type
fromType System.Type
return bool

ShouldUncast() public method

public ShouldUncast ( object duck ) : bool
duck object
return bool

Uncast() public method

public Uncast ( object duck ) : object
duck object
return object