using System.Collections; using System.Collections.Generic; namespace SharpCifs.Util.Sharpen { internal class SynchronizedList : IList { private IList _list; public SynchronizedList(IList list) { this._list = list; } public int IndexOf(T item) { lock (_list) { return _list.IndexOf(item); } } public void Insert(int index, T item) { lock (_list) { _list.Insert(index, item); } } public void RemoveAt(int index) { lock (_list) { _list.RemoveAt(index); } } void ICollection.Add(T item) { lock (_list) { _list.Add(item); } } void ICollection.Clear() { lock (_list) { _list.Clear(); } } bool ICollection.Contains(T item) { lock (_list) { return _list.Contains(item); } } void ICollection.CopyTo(T[] array, int arrayIndex) { lock (_list) { _list.CopyTo(array, arrayIndex); } } bool ICollection.Remove(T item) { lock (_list) { return _list.Remove(item); } } IEnumerator IEnumerable.GetEnumerator() { return _list.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return _list.GetEnumerator(); } public T this[int index] { get { lock (_list) { return _list[index]; } } set { lock (_list) { _list[index] = value; } } } int ICollection.Count { get { lock (_list) { return _list.Count; } } } bool ICollection.IsReadOnly { get { return _list.IsReadOnly; } } } }