chagantivamsi87
New member
- Joined
- Dec 24, 2021
- Messages
- 3
- Programming Experience
- 10+
C#:
Public class viewmodel
{
public string ID {get;set;}
public String name{get;set;}
public List<child1>{get;set;}
}
public class child1
{
public string C1ID {get;set;}
public String C1name{get;set;}
public List<child2>{get;set;}
}
public class child2
{
public string C2ID {get;set;}
public String C2name{get;set;}
public child3{get;set;}
}
Now I need List<Child3> when I pass ViewModel object as input paramenter
I did in this way and its working fine also but not sure its good one or tune further
viewModleObject.child1.Select(item => item.child2)
.FirstOrDefault().Where(t => (t.operation.ToString().Contains("Delete")))
.Select(q => q.child3).ToList();
It should not have multiple loops.
Thanks,
Krishna