If they are going to change, perhaps a static list is better:
private static List<string> Sizes = new List<string> { "large", "medium", "small" }; if (string.IsNullOrEmpty(filename) || Sizes.Contains(size.ToLower())) { }
For cleaner code, encapsulate the size check in your own method and modify this method if necessary:
if (MeetsSizeRequirementsOrIsNull(filename, size)) { } private static bool MeetsSizeRequirementsOrIsNull(string filename, string size) { List<string> sizes = new List<string>() { "..." }; return string.IsNullOrEmpty(filename) || sizes.Contains(size.ToLower()) }
source share