I have a list of dynamic objects
List myDynamicList;
where one item would look similar to below:
dynamic d = ne
web.config
<configuration>
....
<appSettings>
<add key="ExtensionArray" value="dll,exe"/>
</appSettings>
....
</configuration>
C# snippet
string ExtensionArray== WebConfigurationManager.AppSettings["Extension"];
var list=ExtensionArray.Split(',').ToList<string>();
var libraries = myDynamicList.Where(d => list.Any(e=>e==Path.GetExtension(d.FileName)))
.Select(d => d.FileName);
You can use a list to save all the extension that you need and use Contains extension method in your query:
var list=new List<string>(){".dll", ".exe"};
var libraries = myDynamicList.Where(d => list.Contains(Path.GetExtension(d.FileName)))
.Select(d => d.FileName);
You can also use Any extension method:
var libraries = myDynamicList.Where(d => list.Any(e=>e==Path.GetExtension(d.FileName)))
.Select(d => d.FileName);