private Spell CheckForDuplicates(string reqSpellName) { System.Collections.Generic.IEnumerable <Spell> spellQuery = effectList.Where(spell => spell.spellName == reqSpellName); if (spellQuery.Count() > 0) { return(spellQuery.First()); } return(null); }
/// <summary> /// Gets items contained in all colletions. /// </summary> public static HashSet <T> GetCommonItems <T>(IEnumerable <IEnumerable <T> > lists) { if (lists?.Any() != true || lists?.First()?.Any() != true) { return(new HashSet <T>()); } var set = new HashSet <T>(lists.First()); foreach (var list in lists) { if (list != null) { set.IntersectWith(list); } } return(set); }