We want to set a attribute value from app.config and using following code, it gives error
"An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type"
- public class A
- {
- [JsonProperty(ConfigurationManager.AppSettings["Application:ExplicitUserTypeAttribute"]]
- public string ExplicitUserTypeAttribute { get; set; }
- }
I understand this has to be a constant that can be computed at compile time but this is our requirement and I'm wondering if there is any work around to get it working.
Thanks!

Jignesh KumarRank #91 · 22.9K reputationPosted Dec 21, 2018, 5:04 AM EST
Sanwar RanwaRank #23 · 44.7K reputationPosted Dec 21, 2018, 5:17 PM EST