Jon,
Not really:
The pattern (I use) is "For all types that support operators use operators,
but for all other types use Equals...".
Although I didn't state it, my original post was in the context of the
operators are not available, as the original poster indicated the operators
are not available. So I don't see any conflict. Looking back I probably
should have included that in my original post.
Hope this helps
Jay
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com...
| Jay B. Harlow [MVP - Outlook] <Ja************ @msn.com> wrote:
| > Although I don't state it, I thought it was easily inferred:
| >
| > First choice is the = operator on the values themselves (not properties
of
| > the values). Seeing as VB.NET supports the = operator on both Int32 &
| > DateTime, I use the = operator.
|
| But doesn't that then go against:
|
| <quote>
| Using Equals, Compare, or CompareTo allows my code to be consistent
| across all types, rather then needing to remember what property or
| properties I need use for each type.
| </quote>
|
| I could understand a pattern which said "for all the primitive types,
| use operators, but for all other types use Equals" but to use the
| operator for DateTime goes against that. If it's okay to remember
| DateTime, might there not be other value types it's worth remembering?
|
| > The point I am attempting to make is that IMHO its better to compare the
| > values/objects themselves, rather then rely on comparing
| > attributes/properties of the said values/objects.
|
| Sure.
|
| --
| Jon Skeet - <sk***@pobox.co m>
|
http://www.pobox.com/~skeet
| If replying to the group, please do not mail me too