假设我有一个Dictionary对象:
Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();
现在,我想以相反的顺序遍历字典。我不能使用简单的for循环,因为我不知道字典的关键字。foreach很简单:
foreach (SomeObject object in myDictionary.Values)
{
// Do stuff to object
}
但我如何才能反向执行此操作呢?
发布于 2008-09-17 13:42:40
您可以通过LinqBridge在.NET 2.0中使用LINQ to Objects Enumerable.Reverse()函数。
https://stackoverflow.com/questions/82881
复制相似问题