0
I need to sort out a list and I don’t know where to start.
I tried to apply the code below based on some posts, for example: https://stackoverflow.com/questions/298725/multiple-order-by-in-linq , but I really don’t know how to do:
var ret = objCliente.ListaDeClientes();
var retCli = ret.OrderBy(x => x.ID_PAI).ThenBy(x => x.ID_PAI_FILHO);
Can anyone direct me ? or shows an example of how to do ?
The list on the left is disorganized and I need to leave it as the list on the right:
No matter the lists, present the structure of the two classes. It seems you want an orderly parent list, with your children ordered... It seems to me that these objects should be nesting and not at the same level of hierarchy
– Leandro Angelo
@Leandro Angelo the class contains other attributes that I did not present here because it is irrelevant, this list returns from a legacy as I posted, the problem is that I need to sort this list the way I put in the post.
– hard123
It does not explain the ordering, what is the logic of its ordering
– novic