HastTable 沒有Sort
今天要用到Sort,於是google一下,發現有個方法可以達成
就是先以ArrayList將HastTable.Keys先排序後,再讀取HastTable就可以了
Sample code:
ArrayList aKeys = new ArrayList( words.Keys );
aKeys.Sort();
foreach ( string key in aKeys )
fwriter.WriteLine( "{0} :: {1}", key, words[ key ] );
This solves the final sticking point in our solution:
apron :: 1
around :: 1
blossoms :: 3
Reference URL : http://www.informit.com/articles/article.aspx?p=25322&seqNum=17&rl=1

浙公网安备 33010602011771号