Print Page | Close Window

Operator '=' is not defined for DevForce enumeration classes

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=174
Printed Date: 13-Mar-2025 at 6:03pm


Topic: Operator '=' is not defined for DevForce enumeration classes
Posted By: Customer
Subject: Operator '=' is not defined for DevForce enumeration classes
Date Posted: 12-Jul-2007 at 1:32pm
Operator '=' is not defined for DevForce enumeration classes.

Although it seems to be exampled with it in the Developer’s guide…

I’m having to use the Equals method… Is using Equals the best technique?




Replies:
Posted By: IdeaBlade
Date Posted: 12-Jul-2007 at 1:34pm

I believe the default behavior of == [C#] and = [VB], for reference types,  is determine whether the objects being compared represent the same instance.  Equals, on the other hand, looks to determine equality by a prescribed comparison of the two objects (e.g., if it looks like a duck and quacks like a duck, it's a duck).  So I'm not surprised that Equals is the one that's working for enum entities, rather than "=".  Whether the docs are just wrong or there's been some change in the enumeration entities behavior (the behavior of the comparison operators for a given class can be overridden in that class), I'm not entirely sure, but my guess would be that the docs are just wrong, and always were.

Thanks for the heads up - and stick with Equals! 




Print Page | Close Window