How to set attributes values using reflection
.net, asp.net, c#
Solution
I don't believe it's possible to set attributes using reflection - and even if it is, I'd encourage you not to do so.
Attributes should be used for metadata which is known at compile-time. If you want a more dynamic form of metadata, load it from a file or use app.config instead... or at least have some special "placeholder" values (like |DataDirectory| in a connection string) which can be resolved at execution time.
Problem
I have a class decorated with a attribute ...`[DataEntity("MESSAGE_STAGING", EnableCaching = true, CacheTimeout = 43200)]` for some requirement,I want to change this value `MESSAGE_STAGING` at run time to `Test_Message_Staging`. What is the best possible way to achieve this? Can I use reflection, or is there any other way to do this. Please provide code samples. Thanks SNA