I use a Tuple
as the keys in a Dictionary
.
public class Tuple<T1, T2> {
public T1 Item1 { get; private set; }
public T2 Item2 { get; private set; }
// implementation details
}
Be sure to override Equals
and GetHashCode
and define operator!=
and operator==
as appropriate. You can expand the Tuple
to hold more items as needed. .NET 4.0 will include a built-in Tuple
.