Dictionary<TKey, TValue>.KeyCollection Class implements the contains through extension method from IEnumerable, which is O(n)
why doesn’t it have a native one with O(1)? it’s kind of HashSet isn’t it?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It does implement its own Contains. You can’t implement an interface through an extension method. Note that it implements it explicitly, which means you first have to cast it to
ICollectionto use it.