C# 클래스 DeftTech.DuckTyping.DelegateDuckProxyType

Class that performs the generation of duck proxy types for forwarding delegate calls.
파일 보기 프로젝트 열기: deftflux/DuckTyping 1 사용 예제들

공개 메소드들

메소드 설명
CanProxy ( ) : bool

Determines whether a proxy can be generated for the types given in the constructor.

DelegateDuckProxyType ( Type toDelegateType, Type fromDelegateType ) : System

Constructs an object.

Prepare ( ) : void

Prepares by generating the proxy type for the types given in the constructor.

WrapDuck ( Delegate duck ) : Delegate

Calls the static WrapDuck method of the generated proxy type to initialize a new instance of the proxy type with a given duck delegate and return a delegate to its invoke method.

비공개 메소드들

메소드 설명
GenerateProxyType ( ) : void

If a proxy type has not been generated yet, generates a proxy type that defines a method matching the method signature of the to delegate type given in the constructor which forwards calls to a delegate of the from type given in the constructor.

GetParameterTypes ( ParameterInfo parameters ) : System.Type[]

Utility to create an array of parameter types from an array of parameters.

ImplementInvokeMethod ( TypeBuilder proxyType, FieldInfo duckDelegateField ) : MethodBuilder

Implements the method of the proxy type that invokes the delegate given in its constructor.

메소드 상세

CanProxy() 공개 메소드

Determines whether a proxy can be generated for the types given in the constructor.
public CanProxy ( ) : bool
리턴 bool

DelegateDuckProxyType() 공개 메소드

Constructs an object.
public DelegateDuckProxyType ( Type toDelegateType, Type fromDelegateType ) : System
toDelegateType System.Type Type to be casted to.
fromDelegateType System.Type Type of delegate to be casted.
리턴 System

Prepare() 공개 메소드

Prepares by generating the proxy type for the types given in the constructor.
public Prepare ( ) : void
리턴 void

WrapDuck() 공개 메소드

Calls the static WrapDuck method of the generated proxy type to initialize a new instance of the proxy type with a given duck delegate and return a delegate to its invoke method.
public WrapDuck ( Delegate duck ) : Delegate
duck System.Delegate Duck delegate that the new proxy object should forward calls to.
리턴 System.Delegate