Linq OrderBy against specific values

后端 未结 8 1736
悲&欢浪女
悲&欢浪女 2020-12-04 17:41

Is there a way in Linq to do an OrderBy against a set of values (strings in this case) without knowing the order of the values?

Consider this data:

A         


        
8条回答
  •  青春惊慌失措
    2020-12-04 18:23

    Yes, you must implement your own IComparer and then pass it in as the second argument of LINQ's OrderBy method.

    An example can be found here: Ordering LINQ results

提交回复
热议问题