I searched here for the answer. I'm sorry if this has been asked before (as I suspect it has).
Summary: How can I have strongly typed calls into my web.config without duplicating the property names?
Details: In my code, I try to minimize string usage, and I don't like defining something twice.
Complementing both of these wonts is my restriction of AppSettings usage (and its strings) to one class, which I reference throughout the project. The AppSettings class exposes public properties:
12 public static string DateFormatString {
13 get {
14 return ConfigurationManager.AppSettings["DateFormatString"];
15 }
16 }
How can I keep this class and prevent the duplication (lines 12 & 14) of the property name?
Alternatively, what other solution might you recommend?