Hilo seguro clasificado

Hice una clase que usa unSortedDictionary para almacenar y manipular datos. La clase funciona muy bien, excepto cuando se implementa en un entorno multiproceso. Ahora, me gustaría hacer que el hilo de la clase sea seguro escribiendo una clase de contenedor para el internoSortedDictionary clase. Me gustaría usar los bloqueos Reader-Writer para implementar esto, pero por ahora, estoy teniendo problemas para escribir la clase del contenedor. Específicamente, no estoy seguro de cómo implementar elEnumerator para el diccionario Aquí está mi código completo para la clase tal como está ahora.

    public class ConcurrentSortedDictionary<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
{
    #region Variables
    SortedDictionary<TKey, TValue> _dict;
    #endregion
    #region Constructors
    public ConcurrentSortedDictionary()
    {
        _dict = new SortedDictionary<TKey, TValue>();
    }

    public ConcurrentSortedDictionary(IComparer<TKey> comparer)
    {
        _dict = new SortedDictionary<TKey, TValue>(comparer);
    }

    public ConcurrentSortedDictionary(IDictionary<TKey, TValue> dictionary)
    {
        _dict = new SortedDictionary<TKey, TValue>(dictionary);
    }

    public ConcurrentSortedDictionary(IDictionary<TKey, TValue> dictionary, IComparer<TKey> comparer)
    {
        _dict = new SortedDictionary<TKey, TValue>(dictionary, comparer);
    }
    #endregion
    #region Properties
    public IComparer<TKey> Comparer
    {
        get 
        { 
            return _dict.Comparer;
        }
    }

    public int Count
    {
        get
        {
            return _dict.Count;
        }
    }

    public TValue this[TKey key]
    { 
        get
        {
            return _dict[key];
        }

        set
        {
            _dict[key] = value;
        }
    }

    public SortedDictionary<TKey, TValue>.KeyCollection Keys
    {
        get
        {
            return new SortedDictionary<TKey,TValue>.KeyCollection(_dict);
        }
    }

    public SortedDictionary<TKey, TValue>.ValueCollection Values
    {
        get
        {
            return new SortedDictionary<TKey, TValue>.ValueCollection(_dict);
        }
    }

    #endregion
    #region Methods
    public void Add(TKey key, TValue value)
    {
        _dict.Add(key, value);
    }

    public void Clear()
    {
        _dict.Clear();
    }

    public bool ContainsKey(TKey key)
    {
        return _dict.ContainsKey(key);
    }

    public bool ContainsValue(TValue value)
    {
        return _dict.ContainsValue(value);
    }

    public void CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
    {
        _dict.CopyTo(array, index);
    }

    public override bool Equals(Object obj)
    {
        return _dict.Equals(obj);
    }

    IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
    {
        return GetEnumerator();
    }

    public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
    {
        return _dict.GetEnumerator();
    }

    public override int GetHashCode()
    {
        return _dict.GetHashCode();
    }

    public bool Remove(TKey key)
    {
        return _dict.Remove(key);
    }

    public override string ToString()
    {
        return _dict.ToString();
    }

    public bool TryGetValue(TKey key, out TValue value)
    {
        return _dict.TryGetValue(key, out value);
    }
    #endregion
}

Cuando compilo el código, recibo el mensaje de error:

'ConcurrentSortedDictionary' no implementa el miembro de interfaz 'System.Collections.IEnumerable.GetEnumerator ()'. 'ConcurrentSortedDictionary.GetEnumerator ()' no puede implementar 'System.Collections.IEnumerable.GetEnumerator ()' porque no tiene el tipo de retorno correspondiente de 'System.Collections.IEnumerator'.

Miré varias publicaciones aquí relacionadas con esto como referencia:

¿Cómo implemento IEnumerable en mi clase de contenedor de diccionario que implementa IEnumerable <Foo>? ¿Cuál es la mejor manera de implementar un diccionario seguro para subprocesos?

Pero no veo lo que estoy haciendo mal. Cualquier ayuda muy apreciada.

Respuestas a la pregunta(2)

Su respuesta a la pregunta