using System.Collections.Generic;
public static void Main(string[] args)
var myClass = new List<TestClass> {
new TestClass() { MyOtherObject = new OtherClass { Name = "Name" } },
new TestClass() { MyOtherObject = new OtherClass { Name = "John" } },
new TestClass() { MyOtherObject = new OtherClass { Name = null } },
new TestClass() { MyOtherObject = null },
new TestClass() { MyOtherObject = new OtherClass { Name = "Name" } }
var items = myClass.Where(x => x.MyOtherObject?.Name == "Name").ToList();
foreach (var item in items)
Console.WriteLine(item.MyOtherObject.Name);
public OtherClass MyOtherObject {get;set;}
public string Name {get;set;}