C# Class Csla.Reflection.MethodCaller

Provides methods to dynamically find and call methods.
ファイルを表示 Open project: MarimerLLC/csla Class Usage Examples

Public Methods

Method Description
CallMethod ( object obj, System info ) : object

Uses reflection to dynamically invoke a method, throwing an exception if it is not implemented on the target object.

CallMethod ( object obj, string method ) : object

Uses reflection to dynamically invoke a method, throwing an exception if it is not implemented on the target object.

CallMethodIfImplemented ( object obj, string method ) : object

Uses reflection to dynamically invoke a method if that method is implemented on the target object.

CallPropertyGetter ( object obj, string property ) : object

Invokes a property getter using dynamic method invocation.

CallPropertySetter ( object obj, string property, object value ) : void

Invokes a property setter using dynamic method invocation.

CreateGenericInstance ( Type type ) : object

Creates an instance of a generic type using its default constructor.

CreateInstance ( Type objectType ) : object

Uses reflection to create an object using its default constructor.

FindMethod ( Type objectType, string method, Type types ) : MethodInfo

Returns information about the specified method, even if the parameter types are generic and are located in an abstract generic base class.

FindMethod ( Type objectType, string method, int parameterCount ) : MethodInfo

Returns information about the specified method, finding the method based purely on the method name and number of parameters.

GetMethod ( Type objectType, string method ) : MethodInfo

Uses reflection to locate a matching method on the target object.

GetType ( string typeName ) : Type

Gets a Type object based on the type name.

GetType ( string typeName, bool throwOnError ) : Type

Gets a Type object based on the type name.

GetType ( string typeName, bool throwOnError, bool ignoreCase ) : Type

Gets a Type object based on the type name.

IsMethodImplemented ( object obj, string method ) : bool

Detects if a method matching the name and parameters is implemented on the provided object.

Private Methods

Method Description
CallMethod ( object obj, Csla.Reflection.DynamicMethodHandle methodHandle, bool hasParameters ) : object
CallMethod ( object obj, System info, bool hasParameters ) : object
CallMethod ( object obj, string method, bool hasParameters ) : object
CallMethodIfImplemented ( object obj, string method, bool hasParameters ) : object
FindMethodUsingFuzzyMatching ( Type objectType, string method, object parameters ) : MethodInfo
GetCachedConstructor ( Type objectType ) : DynamicCtorDelegate
GetCachedField ( Type objectType, string fieldName ) : Csla.Reflection.DynamicMemberHandle
GetCachedMethod ( object obj, System info ) : Csla.Reflection.DynamicMethodHandle
GetCachedMethod ( object obj, string method ) : Csla.Reflection.DynamicMethodHandle
GetCachedMethod ( object obj, string method, bool hasParameters ) : Csla.Reflection.DynamicMethodHandle
GetCachedProperty ( Type objectType, string propertyName ) : Csla.Reflection.DynamicMemberHandle
GetExtrasArray ( int count, Type arrayType ) : object[]
GetMethod ( Type objectType, string method, bool hasParameters ) : MethodInfo

Method Details

CallMethod() public static method

Uses reflection to dynamically invoke a method, throwing an exception if it is not implemented on the target object.
public static CallMethod ( object obj, System info ) : object
obj object /// Object containing method. ///
info System /// System.Reflection.MethodInfo for the method. ///
return object

CallMethod() public static method

Uses reflection to dynamically invoke a method, throwing an exception if it is not implemented on the target object.
public static CallMethod ( object obj, string method ) : object
obj object /// Object containing method. ///
method string /// Name of the method. ///
return object

CallMethodIfImplemented() public static method

Uses reflection to dynamically invoke a method if that method is implemented on the target object.
public static CallMethodIfImplemented ( object obj, string method ) : object
obj object /// Object containing method. ///
method string /// Name of the method. ///
return object

CallPropertyGetter() public static method

Invokes a property getter using dynamic method invocation.
public static CallPropertyGetter ( object obj, string property ) : object
obj object Target object.
property string Property to invoke.
return object

CallPropertySetter() public static method

Invokes a property setter using dynamic method invocation.
public static CallPropertySetter ( object obj, string property, object value ) : void
obj object Target object.
property string Property to invoke.
value object New value for property.
return void

CreateGenericInstance() public static method

Creates an instance of a generic type using its default constructor.
public static CreateGenericInstance ( Type type ) : object
type System.Type Generic type to create
return object

CreateInstance() public static method

Uses reflection to create an object using its default constructor.
public static CreateInstance ( Type objectType ) : object
objectType System.Type Type of object to create.
return object

FindMethod() public static method

Returns information about the specified method, even if the parameter types are generic and are located in an abstract generic base class.
public static FindMethod ( Type objectType, string method, Type types ) : MethodInfo
objectType System.Type /// Type of object containing method. ///
method string /// Name of the method. ///
types System.Type /// Parameter types to pass to method. ///
return System.Reflection.MethodInfo

FindMethod() public static method

Returns information about the specified method, finding the method based purely on the method name and number of parameters.
public static FindMethod ( Type objectType, string method, int parameterCount ) : MethodInfo
objectType System.Type /// Type of object containing method. ///
method string /// Name of the method. ///
parameterCount int /// Number of parameters to pass to method. ///
return System.Reflection.MethodInfo

GetMethod() public static method

Uses reflection to locate a matching method on the target object.
public static GetMethod ( Type objectType, string method ) : MethodInfo
objectType System.Type /// Type of object containing method. ///
method string /// Name of the method. ///
return System.Reflection.MethodInfo

GetType() public static method

Gets a Type object based on the type name.
public static GetType ( string typeName ) : Type
typeName string Type name including assembly name.
return System.Type

GetType() public static method

Gets a Type object based on the type name.
public static GetType ( string typeName, bool throwOnError ) : Type
typeName string Type name including assembly name.
throwOnError bool true to throw an exception if the type can't be found.
return System.Type

GetType() public static method

Gets a Type object based on the type name.
public static GetType ( string typeName, bool throwOnError, bool ignoreCase ) : Type
typeName string Type name including assembly name.
throwOnError bool true to throw an exception if the type can't be found.
ignoreCase bool true for a case-insensitive comparison of the type name.
return System.Type

IsMethodImplemented() public static method

Detects if a method matching the name and parameters is implemented on the provided object.
public static IsMethodImplemented ( object obj, string method ) : bool
obj object The object implementing the method.
method string The name of the method to find.
return bool