我正在尝试将 System.Linq.Dynamic.Core 与 ImmutableArray 一起用于动态 OrderBy,但出现以下异常:
Expression of type 'System.Collections.Immutable.ImmutableArray`1[$customType]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable`1[$customType]' of method 'System.Linq.IOrderedEnumerable`1[$customType] OrderByDescending[$customType,Int32](System.Collections.Generic.IEnumerable`1[$customType], System.Func`2[$customType,System.Int32])' (Parameter 'arg0')
为什么是这样?他们是否为不可变类型定义了特定的验证?普通 OrderBy 完全有能力对其进行排序。这应该作为功能请求提交给他们,还是我遗漏了一些明显的东西?一旦它被投射到一个列表中,它就像一个魅力。