public class ClassA
{
public string MyString {get; set;}
}
public class ClassB
{
public List<ClassA> MyObjects {get; set;}
}
List<ClassB> classBList = new List<ClassB>();
var results = (from i in classBList select i.MyObjects).ToDistinct();
I want a distinct list of all the ClassA objects in the classBList. How do I go about this using linq? I'm thinking a nested query but couldn't quite figure it out. Any help is very appreciated.