How to solve "No overload for method, takes 0 arguments?" error
<p>In my simple producer/consumer multi threading project I am using a custom queue collection. I defined my <code>TryDequeue</code> like this...</p>

<pre><code>public bool TryDequeue(out F data)
{
    data = default(F);
    bool success = false;
    lock (_queueLock)
    {
        if (_queue.Count &gt; 0)
        {
            data = _queue.Dequeue();
            success = true;
            count--;
        }
    }
    return success;
}
</code></pre>

<p>And when I try this...</p>

<pre><code>private static void Consumer()
{
    while (true)
    {
        Thread.Sleep(100);
        string item = null;
        lock (sharedQueue)
        {
            while (sharedQueue.Count == 0)
                Monitor.Wait(sharedQueue);
            item = sharedQueue.TryDequeue();
        }

    Console.WriteLine("Consuming item: {0}", item);
    }
}
</code></pre>

<p>which is a second thread, I get this error:</p>

<pre><code>Error   1   No overload for method 'TryDequeue' takes 0 arguments   
</code></pre>

<p>Can anyone help me? Thanks.</p>