C#C
C#•15mo ago
FunHyper

Is List.Contains(Object) checks by address or by value?

Hi, if I have the following List/Dictionary (I know it doenst matter in this question):

I want to check if a drink is inside the dictionary like this -
Drinks.ContainsKey(drink)
I'm not sure if it will check by value like if all the values inside the drink are equal or it will check if this is the identical drink (by adress). I want to point out that I overrided Equals inside of Item.
Thank you🙏
image.png
image.png
Was this page helpful?