Dictionary with list of strings as value

前端 未结 4 1829
旧时难觅i
旧时难觅i 2020-12-23 20:55

I have a dictionary where my value is a List. When I add keys, if the key exists I want to add another string to the value (List)? If the key doesn\'t exist then I create a

4条回答
  •  遥遥无期
    2020-12-23 21:23

    Just create a new array in your dictionary

    Dictionary> myDic = new Dictionary>();
    myDic.Add(newKey, new List(existingList));
    

提交回复
热议问题