MemberInfoExtension Class Reference

This Utility class extends the .net MemberInfo class, in order to provide a single method to access both .net PropetyInfo and FieldInfo objects, transparently. Two functions are provided, GetValue and GetSystemType.
A NotImplementedException will be thrown if the provided MemberInfo parameter is for any MemberType other than MemberTypes.Field, or MemberTypes.Property.

Detailed Description

This Utility class extends the .net MemberInfo class, in order to provide a single method to access both .net PropetyInfo and FieldInfo objects, transparently. Two functions are provided, GetValue and GetSystemType.
A NotImplementedException will be thrown if the provided MemberInfo is for any MemberType other than MemberTypes.Field, or MemberTypes.Property.

Static Public Member Functions

static MemberInfo FindMemberByName (object instance, string name)
 Convenience function to find any members in the object's type, with the given name. BindingFlags checked: BindingFlags.Static, BindingFlags.Instance, BindingFlags.NonPublic, BindingFlags.Public
 
static Attribute GetAttributeOfType (this MemberInfo memberInfo, Type attributeType)
 Determines if the specified attribute type is assigned to the provided memberInfo
 
static Type GetSystemType (this MemberInfo memberInfo)
 An Extension Method for the MemberInfo class. It provides specific types of MemberInfo instances, with ability to call GetValue().
It automatically performs a check to see if the MemberInfo is a FieldInfo or PropertyInfo, and call the appropriate class's FieldType or PropertyType function.. WARNING: Calling this function on a MemberInfo instance, that is NOT a FieldInfo or PropertyInfo, will raise a NotImplementedException.
 
static Type GetSystemType (this MemberInfo memberInfo)
 An Extension Method for the MemberInfo class. It provides specific types of MemberInfo instances, with ability to call GetValue().
It automatically performs a check to see if the MemberInfo is a FieldInfo or PropertyInfo, and call the appropriate class's FieldType or PropertyType function.. WARNING: Calling this function on a MemberInfo instance, that is NOT a FieldInfo, PropertyInfo or MethodInfo, will raise a NotImplementedException.
 
static object GetValue (this MemberInfo memberInfo, object forObject)
 This is an Extension Method for the MemberInfo class. It provides specific types of MemberInfo instances, with ability to call GetValue().
It automatically performs a check to see if the MemberInfo is a FieldInfo or PropertyInfo, and call the appropriate class's GetValue() function. WARNING: Calling this function on a MemberInfo instance, that is NOT a FieldInfo or PropertyInfo, will raise a NotImplementedException.
 
static object GetValue (this MemberInfo memberInfo, object forObject)
 This is an Extension Method for the MemberInfo class. It provides specific types of MemberInfo instances, with ability to call GetValue().
It automatically performs a check to see if the MemberInfo is a FieldInfo or PropertyInfo, and call the appropriate class's GetValue() function. WARNING: Calling this function on a MemberInfo instance, that is NOT a FieldInfo or PropertyInfo, will raise a NotImplementedException.
 
static void SetValue (this MemberInfo memberInfo, object forObject, object toValue)
 This is an Extension Method for the MemberInfo class. It provides specific types of MemberInfo instances, with ability to call SetValue().
It automatically performs a check to see if the MemberInfo is a FieldInfo or PropertyInfo, and call the appropriate class's GetValue() function. WARNING: Calling this function on a MemberInfo instance, that is NOT a FieldInfo or PropertyInfo, will raise a NotImplementedException.