Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MainObject
- List<NestedObject>
- NestedObject
- List<ChildObject>
- ChildObject
- ChildObject
- ChildObject
- List<ChildObject>
- ChildObject
- ChildObject
- List<NestedObject>
- NestedObject
- List<ChildObject>
- ChildObject
- List<ChildObject>
- ChildObject
- ChildObject
- NestedObject
- List<ChildObject>
- ChildObject
- ChildObject
- private IEnumerable<T> Iterate<T>(Type type)
- {
- foreach(var p in typeof(type).GetProperties()) {
- IEnumerable<T> collection = p as IEnumerable<T>;
- if (collection != null){
- return collection
- .OfType<T>()
- .Concat<T>(property.SelectMany(p => Iterate<T>(p)));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement