ReflectionUtils Class |
Namespace: Koden.Utils
The ReflectionUtils type exposes the following members.
| Name | Description | |
|---|---|---|
| CallMethod(Object, String, Object) |
Calls a method on an object dynamically.
This version doesn't require specific parameter signatures to be passed.
Instead parameter types are inferred based on types passed. Note that if
you pass a null parameter, type inferrance cannot occur and if overloads
exist the call may fail. if so use the more detailed overload of this method.
| |
| CallMethod(Object, String, Type, Object) |
Calls a method on an object dynamically. This version requires explicit
specification of the parameter type signatures.
| |
| CallMethodCom |
Wrapper method to call a 'dynamic' (non-typelib) method
on a COM object
| |
| CallMethodEx |
Calls a method on an object with extended . syntax (object: this Method: Entity.CalculateOrderTotal)
| |
| CallMethodExCom |
Calls a method on a COM object with '.' syntax (Customer instance and Address.DoSomeThing method)
| |
| CreateComInstance |
Creates a COM instance from a ProgID. Loads either
Exe or DLL servers.
| |
| CreateInstanceFromString |
Creates an instance of a type based on a string. Assumes that the type's
| |
| CreateInstanceFromType |
Creates an instance from a type by calling the parameterless constructor.
Note this will not work with COM objects - continue to use the Activator.CreateInstance
for COM objects.
| |
| GetEnumList |
Returns a List of KeyValuePair object
| |
| GetField |
Retrieve a field dynamically from an object. This is a simple implementation that's
straight Reflection and doesn't support indexers.
| |
| GetProperty |
Retrieve a property value from an object dynamically. This is a simple version
that uses Reflection calls directly. It doesn't support indexers.
| |
| GetPropertyCom |
Retrieve a dynamic 'non-typelib' property
| |
| GetPropertyEx |
Returns a property or field value using a base object and sub members including . syntax.
For example, you can access: oCustomer.oData.Company with (this,"oCustomer.oData.Company")
This method also supports indexers in the Property value such as:
Customer.DataSet.Tables["Customers"].Rows[0]
| |
| GetPropertyExCom |
Returns a property or field value using a base object and sub members including . syntax.
For example, you can access: oCustomer.oData.Company with (this,"oCustomer.oData.Company")
| |
| GetPropertyInfoEx |
Returns a PropertyInfo object for a given dynamically accessed property
Property selection can be specified using . syntax ("Address.Street" or "DataTable[0].Rows[1]") hence the Ex name for this function.
| |
| GetPropertyInfoInternal |
Returns a PropertyInfo structure from an extended Property reference
| |
| GetStaticProperty(String, String) |
Retrieves a value from a static property by specifying a type full name and property
| |
| GetStaticProperty(Type, String) |
Returns a static property from a given type
| |
| GetTypeFromName |
Helper routine that looks up a type name and tries to retrieve the
full type reference in the actively executing assemblies.
| |
| SetField |
Sets the field on an object. This is a simple method that uses straight Reflection
and doesn't support indexers.
| |
| SetProperty |
Sets the property on an object. This is a simple method that uses straight Reflection
and doesn't support indexers.
| |
| SetPropertyCom |
Sets the property on an object.
| |
| SetPropertyEx |
Sets a value on an object. Supports . syntax for named properties
(ie. Customer.Entity.Company) as well as indexers.
| |
| SetPropertyExCom |
Sets the value of a field or property via Reflection. This method alws
for using '.' syntax to specify objects multiple levels down.
ReflectionUtils.SetPropertyEx(this,"Invoice.LineItemsCount",10)
which would be equivalent of:
Invoice.LineItemsCount = 10;
| |
| StringToTypedValue(String, Type) |
Turns a string into a typed value generically.
Explicitly assigns common types and falls back
on using type converters for unhandled types.
Common uses:
* UI -> to data conversions
* Parsers
| |
| StringToTypedValue(String, Type, CultureInfo) |
Turns a string into a typed value generically.
Explicitly assigns common types and falls back
on using type converters for unhandled types.
Common uses:
* UI -> to data conversions
* Parsers
| |
| StringToTypedValueT(String) |
Generic version allow for automatic type conversion without the explicit type
parameter. Defaults conversion to CurrentCulture.
| |
| StringToTypedValueT(String, CultureInfo) |
Generic version allow for automatic type conversion without the explicit type
parameter
| |
| TypedValueToString(Object) |
Converts a type to string if possible. This method uses the current culture for numeric and DateTime values.
It calls the ToString() method on common types and uses a type converter on all other objects
if available.
| |
| TypedValueToString(Object, CultureInfo) |
Converts a type to string if possible. This method supports an optional culture generically on any value.
It calls the ToString() method on common types and uses a type converter on all other objects
if available
|
| Name | Description | |
|---|---|---|
| MemberAccess |
Binding Flags constant to be reused for all Reflection access methods.
|