+ 2

Why am I getting error IDictionary does not contains definition for ContainsValue method ? [solved]

https://code.sololearn.com/cR4TAeZVU6vE/?ref=app ty!

30th Jan 2021, 10:00 AM
Abhay
Abhay - avatar
3 Answers
+ 5
Because there is no ContainsValue method defined in IDictionary! So line 51 gives error. You can read the docs to see all the existing methods.. https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.idictionary-2?view=net-5.0#methods You'll need to use Dictionary to use ContainsValue method.
30th Jan 2021, 10:35 AM
Minho
Minho - avatar
+ 4
Abhay You're welcome :) But they are not the same.. IDictionary is an interface while Dictionary is a class.. But for more info you should read the docs.. They will clear up the differences :) Edit: Maybe this will help 👇 https://forums.asp.net/t/2131680.aspx?Idictionary%2Bvs%2BDictionary%2Breturn%2Bin%2Bmethod%2B
30th Jan 2021, 10:46 AM
Minho
Minho - avatar
+ 3
Minho đŸ‡°đŸ‡· ty :) i thought Dictionary and IDictionary was same thing lol!
30th Jan 2021, 10:42 AM
Abhay
Abhay - avatar