您好我目前有一個集合容器,我需要將其內容轉儲到ArrayList或列表。這個ArrayList包含一個字典對象。如何將Collection <object>轉換爲ArrayList <Dictionary <string,string>>?
現在,如果我有這樣的事情我想這樣做ToList但它不工作
Collection<object> content = new Collection<object>();
....populate content container.....
List <Dictionary<string, string>> lst = new List <Dictionary<string, string>>();
lst= (List< Dictionary<string, string> >) content.ToList();
我如何能做到這一點有什麼建議?
編輯: 我的內容集應該是一個包含地圖的列表。
充滿詞典<字符串,字符串>集合而已? – CookieOfFortune
集合中有什麼樣的對象?你想如何從中得到字符串? –
是的集合填充Dictionary –
Murphy316