Do I have to hash twice in C#?
<p>I have code like the following:</p>

<pre><code>class MyClass
{
    string Name;
    int NewInfo;
}

List&lt;MyClass&gt; newInfo = .... // initialize list with some values
Dictionary&lt;string, int&gt; myDict = .... // initialize dictionary with some values

foreach(var item in newInfo)
{
    if(myDict.ContainsKey(item.Name)) // 'A' I hash the first time here
         myDict[item.Name] += item.NewInfo // 'B' I hash the second (and third?) time here
    else
        myDict.Add(item.Name, item.NewInfo);
}
</code></pre>

<p>Is there any way to avoid doing two lookups in the Dictionary -- the first time to see if contains an entry, and the second time to update the value?  There may even be two hash lookups on line 'B' -- one to get the int value and another to update it.</p>
