Share via


operator '!' cannot be applied to operand of type 'method group'

Question

Tuesday, March 6, 2007 6:38 AM

please correct the syntax here.

 

if (! rowCells.IsproductNameNull)

thanks

 

All replies (5)

Tuesday, March 6, 2007 9:02 AM âś…Answered

I believe the error was because a method was used in the syntax of a property, this should do it:

if (!rowCells.IsProductNameNull())

.....


Tuesday, March 6, 2007 9:15 AM

Hi Friend,

believe the error was because a method was used in the syntax of a property, this should do it:

if (!rowCells.IsProductNameNull())

That's right.I'ven't seen the error msg properly.Even my commonsense didn't direct me.

It should be 'if (!rowCells.IsProductNameNull())' only.

 

Thanx,

Ch.T.Gopi Kumar.


Tuesday, March 6, 2007 5:37 PM

Thanks, ya Ol'Dog. ;-)

it worked perfectly.  Late night & I just couldn't see the problem. 

Cheers

c


Tuesday, March 6, 2007 7:44 PM

 Coleby wrote:

Thanks, ya Ol'Dog. ;-)

it worked perfectly.  Late night & I just couldn't see the problem. 

Cheers

c

Your intuition was correct. Whoever wrote the code for "IsProductNameFull" wrote it as a function instead of a property. Meaning he did:

public function bool IsPropertyNameFull()
{
  return <stuff>;
}

instead of:

public function bool IsPropertyNameFull
{
  get { return <stuff>; }
}

Which, IMO, is kind of a silly thing to do.


Tuesday, March 6, 2007 10:13 PM

thanks, I appreciate your observation.