【发布时间】:2019-06-30 01:50:12
【问题描述】:
我有一个有价格的属性对象列表。我希望列表在一定的价格范围内。
例如
最高价格:800000 最低价格:200000
results = props.results.Where(x => x.PropertyType.ToLower() != propertytype.ToLower() && (x.Price >= minPrice && x.Price <= maxPrice)).OrderByDescending(x => Math.Abs(x.Price - price));
代码运行良好。有没有更好的方法?
【问题讨论】:
-
Better way是什么意思?是表演还是写作? -
只是语法
-
刚刚看到一些反对票。不知道为什么