public static List <T> filterList <T>(List <T> all, List <string> flags, FilteringFunctionDictionary <T> mp) where T : InformationObject { List <T> matching = all; foreach (string s in flags) { List <string> elements = s.Split('-').Where(x => x != "").ToList(); string type = elements[0]; elements.RemoveAt(0); if (mp.checkKey(type) == true) { matching = mp.getFunction(type)(matching, elements); } else { throw new WrongFilterException(type); } } return(matching); }