字典 Key值转换为数组

时间:2015-04-17 13:05:41   收藏:0   阅读:123
public static string[] GetCategories()
    {
        Dictionary<string, int> itemMap = new Dictionary<string, int>(); 
        int count = itemMap.Count;
        string[] keys = new string[count];
        itemMap.Keys.CopyTo( keys, 0 );
        return keys;
    }

 

评论(0)
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!