Unusual compiler error - Equals(object obj)

Error 1 'TexasHoldemCalculator.Card' does not contain a definition for 'equals' and no extension method 'equals' accepting a first argument of type 'TexasHoldemCalculator.Card' could be found (are you missing a using directive or an assembly reference?) C:\Users\Grorange\Documents\Visual Studio Codename Orcas\Projects\TexasHoldemCalculator\TexasHoldemCalculator\Hand.cs 188 16 TexasHoldemCalculator

I have these two functions:


public override boolEquals(objectobj)
{
return base.Equals(obj);
}

public boolEquals(CardOther)
{
if(this== Other)
return true;
return false;
}

Anyone have any ideas? I'm having a hard time deciphering what that is trying to get me to do.

[1368 byte] By [Grorange] at [2008-3-7]
# 1

Hi, Grorange.

It looks like you are attempting to invoke 'equals' method instead of 'Equals'. C# is a case-sensitive language.

nikov at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Visual C# Orcas...
# 2

Well then, before getting there, I tried to implement the == and != operator overloads, and it gave me this:

Warning 2 'Namespace.Card' defines operator == or operator != but does not override Object.Equals(object o) C:\Users\Grorange\Documents\Visual Studio Codename Orcas\Projects\TexasHoldemCalculator\TexasHoldemCalculator\Hand.cs 8 15 TexasHoldemCalculator

How case sensitive is this when you can use Object and object? Or is there a typo?

And, I wasn't using the equals function, I was using Equals... I fixed it by including another function Equals(Card Other). I was getting trouble at first because I was trying to overload the new function, when I shouldn't have. I feel so stupid sometimes, lol.

Grorange at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Visual C# Orcas...
# 3

> How case sensitive is this when you can use Object and object? Or is there a typo?

'object' is an alias for 'System.Object' and 'string' - for 'System.String'. But this not a common rule.

For instance, 'float' is an alias for 'System.Single', and 'bool' - for 'System.Boolean'.

nikov at 2007-10-3 > top of Msdn Tech,Visual Studio Orcas,Visual C# Orcas...

Visual Studio Orcas

Site Classified