خرید بک لینک

Vote count: 0

How to assign an array to dictionary in c#

below code is not working

ArrayList conf_list = new ArrayList();
var variations = new Dictionary<string, List<string>>();

conf_list.Add ("hi");
conf_list.Add ("bye");
conf_list.Add ("ss");
conf_list.Add ("fefe");
conf_list.Add ("gg");
conf_list.Add ("qwq");
conf_list.Add ("trt");

variations["available"] = conf_list;

Error:

Severity    Code    Description Project File    Line    Suppression State
Error   CS0029  Caot implicitly convert type 'System.Collections.ArrayList' to 'System.Collections.Generic.List<string>'  ConsoleApplication1 c:usersadministratordocumentsvisual studio 2015ProjectsConsoleApplication1ConsoleApplication1Program.cs 27  Active

How to push hole array at one time to dictionay??

Note: i dont want to use this method

variations["available"] = new List<string> { "hi","bye" };

asked 24 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 3 خرداد 1395 ساعت: 17:37

صفحه بندی