小编Muh*_*hid的帖子

字典:无法将属性或索引器分配给:它是只读的

我正在尝试更改字典中 Keys 的值,如下所示:

//This part loads the data in the iterator
List<Recommendations> iterator = LoadBooks().ToList();
//This part adds the data to a list 
List<Recommendations> list = new List<Recommendations>();

        foreach (var item in iterator.Take(100))
        {
            list.Add(item);
        }
        //This part adds Key and List as key pair value to the Dictionary
        if (!SuggestedDictionary.ContainsKey(bkName))
        {
            SuggestedDictionary.Add(bkName, list);

        }
       //This part loops over the dictionary contents 
  for (int i = 0; i < 10; i++)
        {
            foreach (var entry in SuggestedDictionary)
            {
                rec.Add(new Recommendations() …
Run Code Online (Sandbox Code Playgroud)

c# setter dictionary key keyvaluepair

4
推荐指数
1
解决办法
3747
查看次数

标签 统计

c# ×1

dictionary ×1

key ×1

keyvaluepair ×1

setter ×1