✅ How does dictionary.ContainsKey() work?
i have a class that implements IEquatable and ICompareable (i think only iequatable is needed for this but i could do both so i did), yet when I try and use it as a key it doesn't seem to work.
here is a pretty much what I have, tho i can send the actual code if needed
what else do I need to do to make this function?
7 Replies
did you also implement GetHashCode (properly)?
no i didn't
i assume that's needed?
thxs
dictionaries use that first to determine if two objects may be equal
is gethashcode part of iequatable?
no, it's a virtual method of
objectah ok
thxs
how do I close this and mark as solved?
or do i not need to do that
If you have no further questions, please use /close to mark the forum thread as answered