if list contains item c# code example
Example 1: list contains type c#
if (within.OfType<Ball>().Any())
Example 2: c# check list of objects for value
var matches = myList.Where(p => p.Name == nameToExtract);
if (within.OfType<Ball>().Any())
var matches = myList.Where(p => p.Name == nameToExtract);