if need to order by a query which need to orderby column1 if not null, if null orderby column2
void Main()
{
List
{
new Order(1, 4),
new Order(null,6),
new Order(2,5),
new Order(null,3),
};
var k = from p in
orderby p.ID ?? p.Count
select p;
}
class Order
{
public int? ID{get;set;}
public int? Count{get;set;}
public Order(int? id,int? count)
{
ID =id;
Count =count;
}
}
No comments:
Post a Comment