E
eramfelt
Why doesnt ArrayList implements the Equals() or GetHashCode() methods?
How is the developer supposed to check if an array list is equal to
another array list? Is the developer supposed to iterate through the
array list to find out if they are equal or not? This should be handled
by the framework classes and I don't want to do any unnecessary
implementation (read copy-paste-problems).
If I look through the other classes in System.Collection I see that no
implements GetHashCode() or Equals(). If none of them do, then it must
be a design choice. But what design choice would that be? If anyone
have any explanation, please let me know.I really want to know.
There is an interface in System.Collections.Generic that is named
IEqualityComparer, which has two methods, Equals() and GetHashCode().
Why make an interface when every class implements those methods? And
why doesn't the default list/collection classes implement this
interface?
<flamebait-to-be-ignored>
If I look to Java, the ArrayList implements equals(), hashCode() as all
good objects should. They have also a good explanation on how it is
done here.
http://shorl.com/gogedrikekati
http://shorl.com/fygafrebrypeko
</flamebait-to-be-ignored>
Sorry that this post was double posted into the usenet aspnet group.
Regards
http://redsolo.blogspot.com
How is the developer supposed to check if an array list is equal to
another array list? Is the developer supposed to iterate through the
array list to find out if they are equal or not? This should be handled
by the framework classes and I don't want to do any unnecessary
implementation (read copy-paste-problems).
If I look through the other classes in System.Collection I see that no
implements GetHashCode() or Equals(). If none of them do, then it must
be a design choice. But what design choice would that be? If anyone
have any explanation, please let me know.I really want to know.
There is an interface in System.Collections.Generic that is named
IEqualityComparer, which has two methods, Equals() and GetHashCode().
Why make an interface when every class implements those methods? And
why doesn't the default list/collection classes implement this
interface?
<flamebait-to-be-ignored>
If I look to Java, the ArrayList implements equals(), hashCode() as all
good objects should. They have also a good explanation on how it is
done here.
http://shorl.com/gogedrikekati
http://shorl.com/fygafrebrypeko
</flamebait-to-be-ignored>
Sorry that this post was double posted into the usenet aspnet group.
Regards
http://redsolo.blogspot.com