viswasiva
asked on
Problem in working with Custom attributes
Team.,
Could you please let me know whether it is possible to set the value of a customattribute (derived from System.Attribute) in .net using reflection? if s, then will be possible to have different values for the customattribute for different instances of the class? Hope I am clear..
This is a bit urgent.Any guidance will really be of great help to me..
Thanks in advance..
Regards,
Viswa
Could you please let me know whether it is possible to set the value of a customattribute (derived from System.Attribute) in .net using reflection? if s, then will be possible to have different values for the customattribute for different instances of the class? Hope I am clear..
This is a bit urgent.Any guidance will really be of great help to me..
Thanks in advance..
Regards,
Viswa
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I'm not an expert on reflection, but i suspect that what you are trying to do is not possible and isn't what attributes are intended for.
Could you not use class properties to store instance-specific metadata instead?
Could you not use class properties to store instance-specific metadata instead?
ASKER
Yeah..I can..But am a bit curious to know what will be the use of setter function in the customattribute class..and when will it be called. I am trying to make use of that..if possible.
AFAIK, attributes are descriptors for the methods, properties, at compile time, and cannot be set at run-time.
Bob
Bob
ASKER
We have GetCustomAttributes() method to get the values of the custom attributes..I want to know whether it can be set? If so, what is the function used for that?