is there any difference in speed between Dictionary.ContainsKey / Value and the foreach loop that checks for a specific key / value?
ContainsKey is faster:
This method approaches operation O (1).
ContainsValue as a foreach loop.
This method performs a linear search; therefore, the average runtime is proportional to Count. That is, this method is an O (n) operation, where n is Count.
Yes.
ContainsKey O (1). ContainsValue, , , .
Source: https://habr.com/ru/post/1725821/More articles:What are initialized by Java object fields? - javaPHP installation script - phpgenerate text sequence in powershell - powershellIs there a way to test layout with RC Selenium - layoutReplacement for a vector that accepts non-standard constructive and non-assignable types - c ++Scala 2.7 collection method - listWS_CLIPCHILDREN and InvalidateRect Behavior on Windows 7 - c ++Delivering functions inside a web service safely in delphi - securityDefining a variable in js file from php file - javascriptXML-сопоставление - XSLT или код? - xmlAll Articles