using System;
using System.Collections.Generic;
using System.ComponentModel;
public sealed class Pair: IEquatable>{
private readonly TFirst first;
private readonly TSecond second;
public Pair(TFirst first, TSecond second)
{
this.first = first;
this.second = second;
}
public TFirst First
{
get { return first; }
}
public TSecond Second
{
get { return second; }
}
public bool Equals(Pair other)
{
if (other == null)
{
return false;
}
return EqualityComparer.Default.Equals(this.First, other.First) &&
EqualityComparer.Default.Equals(this.Second, other.Second);
}
public override bool Equals(object o)
{
return Equals(o as Pair);
}
public override int GetHashCode()
{
return EqualityComparer.Default.GetHashCode(first) * 37 +
EqualityComparer.Default.GetHashCode(second);
}
}