public class MyClass
{
public MyClass();
public long Id { get; set; }
public intScore { get; set; }
public MyClass[] subclasses { get; set; }
public string title { get; set; }
.....
}
The results returned from extrenal source are recursive, I am trying to retrieve the results from the collection using linq or any extension methods using recursion, any help appreciated.
ex; The collection i have is
Myclass results=XXXmethod(xxxx)// which gives me results.
subclasses is a list of type Myclass
, so this list will have again some collection, and inturn that can collection agian nested levels
say the service returned 10 results or Myclass[10]
Myclass[0]
is having again Myclass[4]
which might have 2 or 4, need to build a collection allitems
I am trying to do like this but some are missing
results.class.subclusters.subclasses (o => o.subclasses )
.SelectMany(x => x.subclasses ).ToList()
but which is not giving correct results.