In Key-Value Pairs , keys need not be unique , which Collection to use?
-
Hi, I want to store Key-Value pairs in some data structure. In this "Keys" need not be unique , so HashTable cannot be used. The size of the collection should dynamically increased. I am not able to locate any data structure suitable to my requirement in C#. Please let me know if you have anything your side. Thanks, Ashish
-
Hi, I want to store Key-Value pairs in some data structure. In this "Keys" need not be unique , so HashTable cannot be used. The size of the collection should dynamically increased. I am not able to locate any data structure suitable to my requirement in C#. Please let me know if you have anything your side. Thanks, Ashish
Hello Ashish, Try using the GUID structure for the same. You may refer to the given web link for more assistance with generating GUID keys. http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=335 http://www.csharphelp.com/archives/archive188.html I hope this will help. Regards, Allen
Allen Smith ComponentOne LLC www.componentone.com
-
Hello Ashish, Try using the GUID structure for the same. You may refer to the given web link for more assistance with generating GUID keys. http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=335 http://www.csharphelp.com/archives/archive188.html I hope this will help. Regards, Allen
Allen Smith ComponentOne LLC www.componentone.com
Hi Allen, Thanks for your response .I am not looking for GUID . The Key-value pair will be For Eg , Lookup 49 0 "Unclassified" 1 "Background" 2 "Desktop" 1 "LZHL" In which Key can be duplicate. I need DataStructure/Collection which can increase dynamically and can hold this values. Thanks, Ashish
-
Hi Allen, Thanks for your response .I am not looking for GUID . The Key-value pair will be For Eg , Lookup 49 0 "Unclassified" 1 "Background" 2 "Desktop" 1 "LZHL" In which Key can be duplicate. I need DataStructure/Collection which can increase dynamically and can hold this values. Thanks, Ashish
-
Dictionary<object,List<object>>
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)It seems you need to have unique key in Dictionary also, Dictionary<string,> keyValue = new Dictionary<string,>(); keyValue.Add("1","\"Background\""); keyValue.Add("2", "\"AlignerFail\""); keyValue.Add("3", "\"LZHL\""); keyValue.Add("3", "\"Align\""); Unhandled Exception as already a key present. I need collection which should not contain uniqueness of key. It should accept if keys are duplicate. Can any way we can surpass the key field uniqueness in Hashtable/Dictionary collection?? Thanks, Ashish