Click here to Skip to main content
15,889,116 members
Home / Discussions / C#
   

C#

 
QuestionReflection - dynamically adding custom attributes Pin
imak18-Aug-10 8:10
imak18-Aug-10 8:10 
AnswerRe: Reflection - dynamically adding custom attributes Pin
Not Active18-Aug-10 8:43
mentorNot Active18-Aug-10 8:43 
GeneralRe: Reflection - dynamically adding custom attributes Pin
Ian Shlasko18-Aug-10 9:00
Ian Shlasko18-Aug-10 9:00 
AnswerRe: Reflection - dynamically adding custom attributes Pin
I Believe In GOD18-Aug-10 9:18
I Believe In GOD18-Aug-10 9:18 
GeneralRe: Reflection - dynamically adding custom attributes Pin
Not Active18-Aug-10 15:45
mentorNot Active18-Aug-10 15:45 
AnswerRe: Reflection - dynamically adding custom attributes Pin
AspDotNetDev18-Aug-10 10:17
protectorAspDotNetDev18-Aug-10 10:17 
AnswerRe: Reflection - dynamically adding custom attributes Pin
Member 267876219-Aug-10 3:08
Member 267876219-Aug-10 3:08 
AnswerRe: Reflection - dynamically adding custom attributes Pin
Chris Trelawny-Ross19-Aug-10 6:04
Chris Trelawny-Ross19-Aug-10 6:04 
If it's possible to dynamically add custom attributes to a class, you'll be jumping through so many hoops to do so that perhaps a better question to ask is: "am I trying to do something I shouldn't be trying to do?"

Also, by attempting to do something so far "outside the box" of .Net programming as it was intended by MS that you'll potentially be creating a maintenance problem for whoever works on the code after you.

If you need to dynamically decorate a type, property, etc. with attribute-like information, perhaps a wiser design is to implement your own repository of such information (perhaps a static Dictionary<MemberInfo, MyCustomAttribute>, or some such). If necessary, you can initialize it from the complier-built attributes, but that should be the end of your logic's relationship with attributes.

Just a thought.
QuestionReflection - Dynamically invoking property Pin
imak18-Aug-10 7:13
imak18-Aug-10 7:13 
AnswerRe: Reflection - Dynamically invoking property Pin
Ian Shlasko18-Aug-10 7:28
Ian Shlasko18-Aug-10 7:28 
GeneralRe: Reflection - Dynamically invoking property Pin
Ennis Ray Lynch, Jr.18-Aug-10 7:29
Ennis Ray Lynch, Jr.18-Aug-10 7:29 
GeneralRe: Reflection - Dynamically invoking property Pin
Ian Shlasko18-Aug-10 8:59
Ian Shlasko18-Aug-10 8:59 
GeneralRe: Reflection - Dynamically invoking property Pin
imak18-Aug-10 8:07
imak18-Aug-10 8:07 
GeneralRe: Reflection - Dynamically invoking property Pin
Ian Shlasko18-Aug-10 8:58
Ian Shlasko18-Aug-10 8:58 
AnswerRe: Reflection - Dynamically invoking property Pin
Ennis Ray Lynch, Jr.18-Aug-10 7:28
Ennis Ray Lynch, Jr.18-Aug-10 7:28 
GeneralRe: Reflection - Dynamically invoking property Pin
harold aptroot18-Aug-10 7:47
harold aptroot18-Aug-10 7:47 
GeneralRe: Reflection - Dynamically invoking property Pin
Ennis Ray Lynch, Jr.18-Aug-10 8:02
Ennis Ray Lynch, Jr.18-Aug-10 8:02 
GeneralRe: Reflection - Dynamically invoking property Pin
harold aptroot18-Aug-10 8:41
harold aptroot18-Aug-10 8:41 
GeneralRe: Reflection - Dynamically invoking property Pin
Ennis Ray Lynch, Jr.18-Aug-10 8:43
Ennis Ray Lynch, Jr.18-Aug-10 8:43 
AnswerRe: Reflection - Dynamically invoking property Pin
Luc Pattyn18-Aug-10 13:41
sitebuilderLuc Pattyn18-Aug-10 13:41 
GeneralRe: Reflection - Dynamically invoking property Pin
Eddy Vluggen18-Aug-10 9:56
professionalEddy Vluggen18-Aug-10 9:56 
GeneralRe: Reflection - Dynamically invoking property Pin
harold aptroot18-Aug-10 10:38
harold aptroot18-Aug-10 10:38 
GeneralRe: Reflection - Dynamically invoking property Pin
Ian Shlasko18-Aug-10 10:58
Ian Shlasko18-Aug-10 10:58 
AnswerRe: Reflection - Dynamically invoking property Pin
Luc Pattyn18-Aug-10 13:44
sitebuilderLuc Pattyn18-Aug-10 13:44 
GeneralRe: Reflection - Dynamically invoking property Pin
imak18-Aug-10 8:09
imak18-Aug-10 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.