I would like to use ConfigurationManager
to access some string values from a static class. However, I need to handle specifically the absence of a valu
I'm using something like this:
public static readonly string someStr =
ConfigurationManager.AppSettings["abc"] ?? "default value";
Or to handle empty string:
public static readonly string someStr =
!String.IsNullOrEmpty(ConfigurationManager.AppSettings["abc"]) ?
ConfigurationManager.AppSettings["abc"] : "default value";