C#: How to gracefully pass multiple conditions to Equals()
- by Roy
I'm new to C#, and I'm trying to write a program that selects file types from a FileInfo list.
So far I have something along the lines of:
List<FileInfo> files = new List<FileInfo>();
IEnumerable<FileInfo> result = files.Where(f=>f.Extension.Equals(".jpg", StringComparison.InvariantCultureIgnoreCase)||
f.Extension.Equals(".gif", StringComparison.InvariantCultureIgnoreCase) );
etc
Obviously I'm not happy with this solution, but I don't know how to do this otherwise in a single call.
What's the better way to go about it?