LINQ to Objects 中的 Enumerable.GroupBy 是否保留組中元素的順序?
在MSDN上找到答案:是的。對象的IGrouping<TKey, TElement>生成順序基於 source 中生成 each 的第一個鍵的元素的順序IGrouping<TKey, TElement>。分組中的元素按照它們在 source 中出現的順序產生。
在MSDN上找到答案:是的。
對象的IGrouping<TKey, TElement>生成順序基於 source 中生成 each 的第一個鍵的元素的順序IGrouping<TKey, TElement>。分組中的元素按照它們在 source 中出現的順序產生。
IGrouping<TKey, TElement>
引用自:https://stackoverflow.com/questions/1452507