[Gtk-sharp-list] Missing override of Equals and GetHashCode for structs

Martin Willemoes Hansen mwh@sysrq.dk
Tue, 26 Aug 2003 22:23:59 +0200


On Wed, 2003-08-20 at 22:56, Martin Willemoes Hansen wrote:
> Hi!
> 
> I noticed that the generator do not generate code for Equals and
> GetHashCode but it does generate code for == and != .. 
> 
> I was wondering if something like the following code would be desirable 
> to have the generator generate:
> 
> public override bool Equals (object o)
> {
> 	Foobar temp = (Foobar) o;
> 	return  (this == temp);
> }
> 
> public override int GetHashCode()
> {
> 	return base.GetHashCode();
> }
> 
> Im writing this almost sleeping, hope its not too bad ;)

Hmm seems that -nowarn:0660,0661 should be used as parameters to mcs to
suppress the warnings that are generated from not having implemented the
two functions.

-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail	mwh@sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net
--------------------------------------------------------