c# - Unique pair collection -


i want store 2 strings in collection combination should unique eg

'1','2' '2','1' '1','2' -> not allowed '2','3' 

which collection should use if want both strings keys?

use hashset of keyvaluepair<string, string>.

for example:

hashset<keyvaluepair<string, string>> set = new hashset<keyvaluepair<string, string>>(); set.add(new keyvaluepair<string, string>("1", "2")); set.add(new keyvaluepair<string, string>("1", "2")); 

this produce 1 entry in set.

for reference:

keyvaluepair class

hashset class


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -