I am reading specific AppSetting key/value pairs in Web.config, using hard-coded values, with the code below. This works.
string[] filteredList = webConfigApp.AppSettings.Settings.AllKeys.AsEnumerable().Where(x => x.Equals("appMode") || x.Equals("loggingMode") || x.Equals("ticketModeCache") || x.Equals("ticketMode")).ToArray();
Instead, I would like to read from a comma-separated list that is also in Web.config, for example:
<add key="setConfigValues" value="appMode,loggingMode,ticketModeCache,ticketMode,twilioMode,kioskId,kioskPrinterConfig" />
I know how to to parse and create a List<> doing something along these lines...
List<string> ConfigValues = ConfigurationManager.AppSettings["setConfigValues"].Split(',').ToList();
...but I am not sure how to code the Linq part to include values in the List.
How can I do this? I tried x.Contains but that does not work (understandably). I am looking to find AppSetting keys that are in the comma-delimited list. Thanks.