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