Reputation: 4906
I have below list:
Where i want to show all the records which contains Status equals to 6 at the last of the list. (*The status would be any starting from 1 to 20 for different properties.)
How can i do this?
Upvotes: 0
Views: 250
Reputation: 89305
If I understand this correctly, you can use OrderBy()
in the following way so that items with Status == 6
are returned after the other items :
OrderBy(o => o.Status == 6 ? 1 : 0)
Upvotes: 3
Reputation: 1041
use below code i think that will help you. and replace with your property you wan't that thank you.
LastOrDefault(x => x.property).where(x.status ==6)
Upvotes: 0
Reputation: 4844
You have list of items and you can show last record of this list. It should be use LastOrDefault function.
Upvotes: 0