NotifyCollectionChangedAction.Add?

Posted by Mark on Stack Overflow See other posts from Stack Overflow or by Mark
Published on 2010-05-06T20:06:55Z Indexed on 2010/05/06 20:18 UTC
Read the original article Hit count: 1087

I'm getting this exception

Constructor supports only the 'Reset' action.

On the last line of this function

        public void Enqueue(TValue val, TPriority pri = default(TPriority))
        {
            ++count;
            if (!dict.ContainsKey(pri)) dict[pri] = new Queue<TValue>();
            dict[pri].Enqueue(val);
            OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add));
        }

I can guess how to fix it, but I don't understand what's causing it. I'm adding an item to my collection. Should I not be using the Add action?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .net-4.0