R
Raj Wall
Hi,
I am trying to implement the IEqualityComparer interface for a struct so I can use it as the Key for a Dictionary.
My struct declaration has:
public struct Ring : IEqualityComparer
{
....
}
and I am trying to implement the Equals and GetHashCode methods.
I thought I could use forms like:
public bool Equals(Ring X, Ring Y)
{...
}
and
public int GetHashCode(Ring X)
{...
}
But they gave errors. From the error message I thought I should try the following:
public bool System.Collections.IEqualityComparer.Equals(Ring X, Ring Y)
{...
}
and
public int System.Collections.IEqualityComparer.GetHashCode(Ring X)
{...
}
But they give "modifier 'public' is not valid for this item.
Thanks for any advice!
Regards,
Raj
I am trying to implement the IEqualityComparer interface for a struct so I can use it as the Key for a Dictionary.
My struct declaration has:
public struct Ring : IEqualityComparer
{
....
}
and I am trying to implement the Equals and GetHashCode methods.
I thought I could use forms like:
public bool Equals(Ring X, Ring Y)
{...
}
and
public int GetHashCode(Ring X)
{...
}
But they gave errors. From the error message I thought I should try the following:
public bool System.Collections.IEqualityComparer.Equals(Ring X, Ring Y)
{...
}
and
public int System.Collections.IEqualityComparer.GetHashCode(Ring X)
{...
}
But they give "modifier 'public' is not valid for this item.
Thanks for any advice!
Regards,
Raj