HashSet versus Dictionary<T, K> w.r.t searching time to find if an item exists

Posted by halivingston on Stack Overflow See other posts from Stack Overflow or by halivingston
Published on 2010-04-28T10:11:19Z Indexed on 2010/04/28 10:43 UTC
Read the original article Hit count: 224

Filed under:
|
|
|
HashSet<T> t = new HashSet<T>();
// add 10 million items


Dictionary<T, K> t = new Dictionary<T, K>();
// add 10 million items.

Whose .Contains method will return quicker?

Just to clarify, my requirement is I have 10 million objects (well, strings really) that I need to check if they exist in the Data Structure. I will NEVER iterate.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#