Re: Comparing Array Objects
From: Alvin Bruney [MVP] (vapor)
Date: 02/24/04
- Next message: Patrick O'Gorman: "Re: Invoking a static method..? HELP!!"
- Previous message: Christopher Kimbell: "Re: How can i get the list of Com ports in machine."
- In reply to: Michael S: "Re: Comparing Array Objects"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 24 Feb 2004 12:29:24 -0600
> However, on a side-note, when realizing a ValueType class, like a struct
in
> C#; forgetting to override Equals, GetHashCode and ToString should be a
> criminal offence. =)
No. not true at all.
An application even as gracious as the framework cannot uncover every
programmer's intent. In this regard, overriding must be a recommendation
albeit a strong one. But it cannot be manditory as in a criminal offense
which is what you are implying. Throughout the programming life cycle there
may be times when overriding is not needed even for valuetype classes. A
framework needs to be as flexible as possible which is why overriding is
always optional.
-- Regards, Alvin Bruney [ASP.NET MVP] Got tidbits? Get it here... http://tinyurl.com/3he3b "Michael S" <a@b.c> wrote in message news:uWFhtFs%23DHA.2524@tk2msftngp13.phx.gbl... > > "Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message > news:MPG.1aa3f876e1ef241798a1d6@msnews.microsoft.com... > > Raphael Iloh <ilohraphael_NOSPAM@hotmail.com> wrote: > > > ...thanks Alvin but your explanation falls short given the following > > > example: > > > The real reason is that Array doesn't override the Equals method > > (unlike, say, String). > > This is the real explaination. One should never assume that comparison are > value-based. Hence that two different arrays are not equal, is working as > designed. > > However, on a side-note, when realizing a ValueType class, like a struct in > C#; forgetting to override Equals, GetHashCode and ToString should be a > criminal offence. =) > > - Michael S > > ps. > Keep up the good work Skeet. I like you posts.... > >
- Next message: Patrick O'Gorman: "Re: Invoking a static method..? HELP!!"
- Previous message: Christopher Kimbell: "Re: How can i get the list of Com ports in machine."
- In reply to: Michael S: "Re: Comparing Array Objects"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|