C# linq sort - quick way of instantiating IComparer

后端 未结 5 1243
遥遥无期
遥遥无期 2021-02-01 03:42

When using linq and you have

c.Sort()

Is there any good inline way of defining a Comparison and/or IComparer class w

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-01 04:00

    That's one of the uses of lambda expressions:

    c.Sort( (x,y) => x.A.CompareTo(y.A))

提交回复
热议问题