LINQ OrderBy versus ThenBy

前端 未结 4 538
长发绾君心
长发绾君心 2020-11-27 12:40

Can anyone explain what the difference is between:

tmp = invoices.InvoiceCollection
              .OrderBy(sort1 => sort1.InvoiceOwner.LastName)
                  


        
4条回答
  •  我在风中等你
    2020-11-27 12:49

    Yes, you should never use multiple OrderBy if you are playing with multiple keys. ThenBy is safer bet since it will perform after OrderBy.

提交回复
热议问题