Check if an enum has a field that equals a string
What's the reason behind Any
… Equals
? Did you overlook Contains
?
bool result = Enum.GetNames(typeof(FileExtensions)).Contains("mp3");
While pressing submit I thought of the answer myself:
Enum.GetNames(typeof(FileExtensions)).Any(f=>f.Equals("."+file.Extension))