PropertyExtensions
Extension methods for locating and accessing properties.
Creates a delegate which can get the value of an indexer.
public static MethodInvoker DelegateForGetIndexer(this Type type, Flags bindingFlags, Type[] parameterTypes)
Creates a delegate which can get the value of an indexer matching bindingFlags.
Creates a delegate which can get the value of the property specified by
on the given .
public static MemberGetter DelegateForGetPropertyValue(this Type type, string name, Flags bindingFlags)
Creates a delegate which can get the value of the property specified by
matching on the given .
Creates a delegate which can set an indexer
public static MethodInvoker DelegateForSetIndexer(this Type type, Flags bindingFlags, Type[] parameterTypes)
Creates a delegate which can set an indexer matching bindingFlags.
Creates a delegate which can set the value of the property specified by
on the given .
public static MemberSetter DelegateForSetPropertyValue(this Type type, string name, Flags bindingFlags)
Creates a delegate which can set the value of the property specified by
matching on the given .
Gets the value of the indexer of the given obj
Gets the value of the indexer of the given obj
Gets the value of the indexer matching bindingFlags of the given obj
public static object GetIndexer(this object obj, Type[] parameterTypes, Flags bindingFlags, object[] parameters)
Gets the value of the indexer matching bindingFlags of the given obj
Gets the value of the property specified by on the given .
Gets the value of the property specified by matching
on the given .
Gets the value of the property specified by on the given .
Gets all public and non-public instance properties on the given type,
including properties defined on base types. The result can optionally be filtered by specifying
a list of property names to include using the names parameter.
Gets all properties on the given type that match the specified bindingFlags,
including properties defined on base types.
Gets the property identified by name on the given type. This method
searches for public and non-public instance properties on both the type itself and all parent classes.
Gets the property identified by name on the given type.
Use the bindingFlags parameter to define the scope of the search.
Sets the value of the indexer of the given obj
Sets the value of the indexer of the given obj
Sets the value of the indexer matching bindingFlags of the given obj
public static object SetIndexer(this object obj, Type[] parameterTypes, Flags bindingFlags, object[] parameters)
Sets the value of the indexer matching bindingFlags of the given obj
Sets the property specified by on the given to the
specified .
public static object SetPropertyValue(this object obj, string name, object value, Flags bindingFlags)
Sets the property specified by matching
on the given to the specified .
public static object SetPropertyValue(this object obj, Expression<Func<object>> memberExpression, object value)
Sets the property specified by on the given to the
specified .
Gets the first (public or non-public) instance property with the given name on the given
obj object. Returns the value of the property if a match was found and null otherwise.
Gets the first property with the given name on the given obj object.
Returns the value of the property if a match was found and null otherwise.
Use the bindingFlags parameter to limit the scope of the search.
Sets the first (public or non-public) instance property with the given name on the
given obj object to the supplied value. Returns true
if a value was assigned to a property and false otherwise.
public static bool TrySetPropertyValue(this object obj, string name, object value, Flags bindingFlags)
Sets the first property with the given name on the given obj object
to the supplied value. Returns true if a value was assigned to a property and false otherwise.
Use the bindingFlags parameter to limit the scope of the search.