I feel like I'm about to get in over my head, so before I go off the
deep end I'm hoping someone can point me in the right direction.
I started down the road of using a List<> of an Interface type.
I wanted to be able to use List.Contains() to determine if the List
already has a certain object based on the Name property - which is
defined by the Interface.
Well it didn't work at first, so I read up and found that I need to
override the Equals and == methods. That was pretty easy, but then I
got warnings that I need to override GetHashCode.
Now, here's my fear:
I want to compare based on Name, but Name is a get-able and set-able
property of the classes that implement ISample. There are quite a few
warnings about how the hash code can never change. But with Name being
set-able, I can't be sure it won't change.
I need Name to be get/set-able because the class is deserialized and I
need a parameterless constructor to do that.
So what do I do??? Thanks for any help...
--Brian