Expanding on the comments, if you want the row to function as an aggregate hash instead of just as a key, you would want to create a custom IEqualityComparer<(string, string)>
and pass it to a HashSet.
public class ValueTupleEqualityComparer : IEqualityComparer<(string s1, string s2)>
{
public bool Equals((string s1, string s2) other)
{
return base.Equals(other);
}
public bool Equals((string s1, string s2) x, (string s1, string s2) y)
{
if (object.ReferenceEquals(x, y))
return true;
if (x.s1 == y.s1 && x.s2 == y.s2)
return true;
if (x.s1 == y.s2 && x.s2 == y.s1)
return true;
return false;
}
public int GetHashCode((string s1, string s2) obj)
{
return base.GetHashCode();
}
}
When testing this against your data set:
var hashSet = new HashSet<(string s1, string s2)>(new ValueTupleEqualityComparer());
hashSet.Add(("txt", "data"));
hashSet.Add(("txt", "txt"));
hashSet.Add(("txt", "data"));
hashSet.Add(("data", "txt"));
hashSet.Add(("exe", "path"));
hashSet.Add(("exe", "path2"));
hashSet.Add(("exe", "path"));
the following results are outputted:
txt data
txt txt
exe path
exe path2
This gives you unique results where both the "column1" and "column2" are used, regardless of order.