Exclude files with a certain extension from list

string invalidExtension = (from p in new List<string> 
{ ".dll", ".pdb", ".suo", ".docstates", ".ico", ".bmp", ".vs10x", ".vspscc", ".vssscc", ".vsp", ".scc", ".user", ".ctl", ".datasource", ".vsmdi", ".testsettings", ".trx", ".dat" }
                            where p == files[i].Extension.ToLower()
                            select p).FirstOrDefault();
 
if (string.IsNullOrEmpty(invalidExtension))
{
//Means it has an invalid extension
}

Comments

Popular posts from this blog

Tutorial: Using Google Cloud Storage from C# and .NET

Late 2008 Macbook only giving 1.5 gb/s speed with 6 gb/s Intel SSD?

Enable Visual Studio to use more than 2GB of memory