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:
Comments
Post a Comment