top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can we have same key value pair in Hashtable?

0 votes
243 views
Can we have same key value pair in Hashtable?
posted May 17, 2017 by Madhavi Kumari

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The hashtable key must be unique: you can't add the same key twice into it. You may use List or HashSet where T is the key-value pair of your class (or use the .net KeyValuePair class) or the Dictionary class where V the list or set but you'll still need to manage the duplicate key insertion manually.

answer May 23, 2017 by Shweta Singh
Similar Questions
0 votes

I want to implement the encryption and that to only to value in key-value pair in mongodb .Can anyone please provide a workable solution?

+1 vote

Query description: I have a collection name student_db and added a document in a collection with entries (name: "alok, age : 31 and profession: "xyz"). After inserting the document into student_db database, I want to add another (key:value ) pair i.e. salary: 50000.

Can someone help me out to resolve this problem ?

...