Hashtable with multiple values for single key

后端 未结 11 1497
渐次进展
渐次进展 2021-02-13 13:36

I want to store multiple values in single key like:

HashTable obj = new HashTable();
obj.Add(\"1\", \"test\");
obj.Add(\"1\", \"Test1\");

Right

11条回答
  •  抹茶落季
    2021-02-13 14:06

    you can put your test,test1,test2,... in a table and then put this table in a Hashtable as a value for the key which will be the same for all them.

    For example try something like this:

    List list = new List();
    list.Add("test");
    list.Add("test1"); 
    

    and then:

    HashTable obj = new HashTable();
    obj.Add("1", list);
    

提交回复
热议问题