[Mono-list] CS0659 warning not emitted.
Roberto Jimeno
jimeno@servidor.unam.mx
06 Jun 2004 01:59:51 -0500
Hi all!
AFAIK, when a class overrides the Object.Equals(Object) method and do
not overrides the Object.GetHashCode(Object) a warning should be emitted
by the compiler. In fact I remember I've seen mcs behaving like this in
the past, but now that I've upgraded mcs I'm not getting that warning
anymore.
Please tell me if you think this is actually a bug and I should zilla it
or not? A simple example at the end of this message.
Thanks!
(have I just created a neologism? "Zilla that bug!" instead of "Create a
bugzilla report for that bug!")
using System;
using System.Collections;
class Obj
{
public override Boolean Equals(Object o){
Console.WriteLine("Equals(Object) was called");
return true; // or false; no matter which one.
}
}
class principal
{
public static void Main()
{
Obj a = new Obj();
Obj b = new Obj();
ArrayList al = new ArrayList();
al.Add(a);
al.Contains(b);
}
}