what is the fastest way to generate a unique set in .net 2

前端 未结 6 821
离开以前
离开以前 2021-01-12 21:46

I have what is essentially a jagged array of name value pairs - i need to generate a set of unique name values from this. the jagged array is approx 86,000 x 11 values. It d

6条回答
  •  感动是毒
    2021-01-12 22:24

    if you don't need any specific correlation between each key/value pair and the unique values you're generating, you could just use a GUID? I'm assuming the problem is that your current 'Key' isn't unique in this jagged array.

    Dictionary> myDict 
       = new Dictionary>();
    
    
    foreach of your key values in their current format
       myDict.Add(System.Guid.NewGuid(), new KeyValuePair(yourKey, yourvalue))
    

    Sounds like it would store what you need but I don't know how you would pull data back from this as there would be no semantic relationship between the generate Guid & what you originally had...

    Can you provide any more info in your question?

提交回复
热议问题