T
tobiwan_kenobi
public static InfoAttribute GetInfo(Enum instance)
{
Type type = instance.GetType();
MemberInfo[] mis = type.GetMember(instance.ToString(), BindingFlags.Public
|
BindingFlags.NonPublic | BindingFlags.Static |
BindingFlags.FlattenHierarchy);
Type attributeType = typeof(InfoAttribute);
IList attrs = FindAttributes(false, memberInfo, attributeType);
InfoAttribute ia = attrs[0] as InfoAttribute;
return ia;
}
Now that I have a reference to an instance of the attribute for an object.
How can I get the instance of the object to which the instance of the
attribute is associated?
public static object GetInfo(InfoAttribute attribute)
{
...
return infoObject
}
{
Type type = instance.GetType();
MemberInfo[] mis = type.GetMember(instance.ToString(), BindingFlags.Public
|
BindingFlags.NonPublic | BindingFlags.Static |
BindingFlags.FlattenHierarchy);
Type attributeType = typeof(InfoAttribute);
IList attrs = FindAttributes(false, memberInfo, attributeType);
InfoAttribute ia = attrs[0] as InfoAttribute;
return ia;
}
Now that I have a reference to an instance of the attribute for an object.
How can I get the instance of the object to which the instance of the
attribute is associated?
public static object GetInfo(InfoAttribute attribute)
{
...
return infoObject
}