c# check if list element contains the same value 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);