public void _0001_CastItemToEnumerable() { IPersonCollection pc = new PersonCollection(); pc.Add(new PersonItem("Simpson", "Homer")); pc.Add(new PersonItem("Simpson", "Bart")); pc.Cast <IPersonItem>().FirstOrDefault(n => n.First == "Simpson"); }
public void _0002_CastItemToEnumerable() { IPersonCollection pc = new PersonCollection(); pc.Add(new PersonItem("Simpson", "Homer")); pc.Add(new PersonItem("Simpson", "Bart")); IEnumerable <IPersonItem> x; x = new List <IPersonItem>(); foreach (var item in x) { } pc.Cast <IPersonItem>().FirstOrDefault(n => n.First == "Simpson"); }