I am new to C# and have a project where I have a List String and have to filter some images out with certain extensions . This is my code
// App Config
<add key="FilterImages" value=".jpg ,.gif"/>
List<string> _FilterList = new List<string>();
string[] FilterList = ConfigurationManager.AppSettings["FilterImages"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in FilterList)
{
_FilterList.Add(s.Trim().ToLower());
}
var files = newFiles.ListDirectory(".");
foreach (var f in files)
{
// Here new files come and I can get the file names using
// f.name ... How can I check for correct extension here
}
Inside the ForEach loop I would like to use _FilterList and check the file extension of the new files coming in . I can get the file names using f.Name any suggestions would be great