I have A list
key ParentKey
1 Null
2 1
3 Null
4 Null
5 1
6 4
7 6
8 3
I want it sorted in
key ParentKey
1 Null
2 1
5 1
3 Null
8 3
4 Null
6 4
7 6
via linq how can this be done?
Any help is most wellcome
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming that the result should be:
I can say that you can’t do anything if there isn’t a logic that make the null values in that position into the list.
So using Linq you can order the list using the OrderBy() function:
But using this function the result is the following: