LINQ到对象:确实GROUPBY preserve元素的顺序? [英] Linq to Objects: does GroupBy preserve order of elements?
本文介绍了LINQ到对象:确实GROUPBY preserve元素的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请问Enumerable.GroupBy从LINQ到对象preserve元素的组顺序?
解决方案
的IGrouping对象产生在基于所产生的每个IGrouping的第一密钥在源中的元素的顺序的顺序。在一个分组的元素产生在它们出现在源代码的顺序。
Does Enumerable.GroupBy from LINQ to Objects preserve order of elements in the groups?
解决方案
Found answer in MSDN: yes.
The IGrouping objects are yielded in an order based on the order of the elements in source that produced the first key of each IGrouping. Elements in a grouping are yielded in the order they appear in source.
这篇关于LINQ到对象:确实GROUPBY preserve元素的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文