Created
December 13, 2013 17:51
-
-
Save 5thWall/9c5e8450c2e1b6307d6b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LINQ all the things | |
bool FilesValid(HttpFileCollection files, IEnumerable<String> allowedExtensions) | |
{ | |
return files.AllKeys.Select(s => files[s]) | |
.Any(fi => !AllowedExtensions.Any(s => fi.FileName.EndsWith(s))); | |
} | |
// LINQ some of the things | |
bool FilesValid(HttpFileCollection files, IEnumerable<String> allowedExtensions) | |
{ | |
foreach (HttpPostedFile file in files.AllKeys.Select(s => files[s])) | |
{ | |
if (!AllowedExtensions.Any(s => file.FileName.EndsWith(s))) | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment