Given that the question is formulated, this may not be the answer you are looking for, but the easiest way is to use a struct:
struct Ratio
{
public Ratio(int a, int b)
{
this.a = a;
this.b = b;
}
public int a = 1;
public int b = 1;
}
You will almost certainly want to use properties instead of fields, and you will probably also want to overload ==and !=, something like:
public static bool operator ==(Ratio x, Ratio y)
{
if (x.b == 0 || y.b == 0)
return x.a == y.a;
return (x.a * y.b) == (x.b / y.a);
}
public static bool operator !=(Ratio x, Ratio y)
{
return !(x == y);
}
public override string ToString()
{
return string.Format("{0}:{1}", this.a, this.b);
}