如何过滤列表集合 [英] How to filter a collection of List

查看:75
本文介绍了如何过滤列表集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个列表< hotel> ,我将其绑定到列表视图,此列表包含具有值和null值的列.我正在按升序和降序进行排序.没问题,它起作用了

Hi,

I have a list<hotel> ,which i''m binding to a listview, This list contain columns with values and null values. I''m doing sorting in both ascending and descending order. Descending no problem it works

lstHotels.DataSource = lstHotelList.OrderByDescending(o => o.MinPrice).ToList();


升序


in Ascending order

lstHotels.DataSource = lstHotelList.OrderBy(o => o.MinPrice).ToList();


在这种情况下,具有空值的行显示在顶部,
我想要的是我想在顶部显示较小值的记录,并将具有空值的记录放在listview的末尾

怎么办?
任何帮助将不胜感激

问候
Chinnu


in this case the rows that have null values are appearing on the top,
What I want is I want to show records with smaller value on the top and put the records with null values at the end of listview

how to do?
ANy help wil be appreciated

Regards
Chinnu

推荐答案

我认为您必须提供笨拙的排序逻辑才能做到这一点:
http://www.zagstudio.com/blog/441#.UHEhq5jMhnE [
I think you''ll have to provide a cumstom sort logic to do that:
http://www.zagstudio.com/blog/441#.UHEhq5jMhnE[^]


这篇关于如何过滤列表集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆