KeyValuePair泛型用法

定義可設置或檢索的鍵/值對。

命名空間:System.Collections.Generic

程序集:mscorlib(在 mscorlib.dll 中)

Dictionary.Enumerator.Current 屬性返回此類型的實例。


//Dictionary<string, int> dicNum = new Dictionary<>(string, int);

foreach(KeyValuePair<string, int> kvp in dicNum)

{

    Console.Write(string.Format("{0} = {1};", kvp.Key, kvp.Value));

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章