ConcurrentDictionary AddOrUpdate a list
<p>I'm trying to use a ConcurrentDictionary to help with a filtering task.</p>

<p>If a number appears in list, then I want to copy an entry from one dictionary to another.</p>

<p>But this part of the AddOrUpdate is not right -  <code>v.Add(number)</code> </p>

<p>I get </p>

<blockquote>
  <p>"Cannot implicitly convert type 'void' to
  'System.Collections.Generic.List'</p>
</blockquote>

<p>And two more errors.</p>

<pre><code>class Program
{
    static void Main(string[] args)
    {
        Program p = new Program();
        List&lt;int&gt; filter = new List&lt;int&gt; {1,2};
        p.Filter(filter);
    }


    private void Filter(List&lt;int&gt; filter)
    {
        Dictionary&lt;string, List&lt;int&gt;&gt; unfilteredResults = new Dictionary&lt;string, List&lt;int&gt;&gt;();
        unfilteredResults.Add("key1", new List&lt;int&gt; { 1,2,3,4,5});

        ConcurrentDictionary&lt;string, List&lt;int&gt;&gt; filteredResults = new ConcurrentDictionary&lt;string, List&lt;int&gt;&gt;();

        foreach (KeyValuePair&lt;string, List&lt;int&gt;&gt; unfilteredResult in unfilteredResults)
        {
            foreach (int number in unfilteredResult.Value)
            {
                if (filter.Contains(number))
                {
                    filteredResults.AddOrUpdate(unfilteredResult.Key, new List&lt;int&gt; { number }, (k, v) =&gt; v.Add(number));
                }
            }
        }
    }
}
</code></pre>