LINQ multiple order by

后端 未结 3 841
既然无缘
既然无缘 2020-12-21 05:09

I have created a function that has the follwing parameter:

List>> orderBy = null

T

3条回答
  •  长情又很酷
    2020-12-21 05:26

    try this

       IOrderedQueryable temp = null; 
       foreach (Expression> func in orderBy) 
        { 
          if (temp == null) 
            { 
              temp = catalogProducts.OrderBy(func);
            } 
            else
            { 
              temp = temp.OrderBy(func); 
            } 
         }
    

提交回复
热议问题