我现在正在使用OrderByDescending对IEnumerable集合的元素进行排序,而我所做的就是分配回同一个集合。
this.InputParts =
this.InputParts.OrderByDescending(lazy => lazy.Metadata.Priority);
从msdn,似乎它有一个延迟的返回对象。 (它有一个返回值,类似于我可视化为C ++中的值传递)
我想,应该有一些可以执行引用类型排序的东西。
说,而不是
this.InputParts =
this.InputParts.OrderByDescending(lazy => lazy.Metadata.Priority);
我们只是说,
//shall itself reorder the collection!
this.InputParts.SomeMSDNFunction(lazy => lazy.Metadata.Priority);
(我想回到同一个列表可能会带来性能问题。顺便说一下,我只是猜测!)