Class A
{
string name;
IList<A> minorList = new List<A>();
}
IList<A> majorList = new List<A>();
I Want to get the instance of A from majorList depending upon the name value, but it is not necessary to have it in the majorList. minorList can also contain the name. How can I get it using Linq. If it is there in only majorList I can get it by using
A a = majorList.First(s => s.Name == "Name");
How about if it is not in the majorList but in some of the List of instance of majorList?
Sounds like you want something like:
Then:
Of course you end up with a problem if there are any cycles in your lists…