【发布时间】:2010-10-11 03:46:33
【问题描述】:
我已经编写了以下代码并且它也可以工作 - 但我想知道他们是否比这更好:
NameValueCollection optionInfoList = ..... ;
if (aSorting)
{
optionInfoListSorted = new nameValueCollection();
String[] sortedKeys = optionInfoList.AllKeys;
Array.Sort(sortedKeys);
foreach (String key in sortedKeys)
optionInfoListSorted.Add(key, optionInfoList[key]);
return optionInfoListSorted;
}
【问题讨论】:
标签: c# sorting collections