|
-
Sep 29th, 2007, 08:56 AM
#3
Re: [2.0] Equals method
In the case of value types, such as integers, there is no functional difference between the two; however, the Equals method will cause one of the two to be boxed into a reference type, and is thus less efficient than using the != or == operators.
In the case of reference types, the != and == operators perform an identity comparison (i.e. whether or not the references point to the same object). The Equals method attempts to perform a value comparison (i.e. whether or not the references point to objects that both represent the same data [and may or may not be the same object]).
Classes usually provide their own implementation of the Equals method in order to facilitate correct value comparisons between instances of their type.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|