#if NET20 || NET30 || NET35 || NET40 || !NET_4_6 using System.Collections.Generic; using LinqInternal.Core; namespace System.Collections.ObjectModel { public partial class ReadOnlyDictionary { [Serializable] public sealed class ValueCollection : ICollection, ICollection { private readonly ICollection _wrapped; internal ValueCollection(ICollection wrapped) { if (wrapped == null) { throw new ArgumentNullException("wrapped"); } _wrapped = wrapped; } public int Count { get { return _wrapped.Count; } } bool ICollection.IsSynchronized { get { return ((ICollection)_wrapped).IsSynchronized; } } object ICollection.SyncRoot { get { return ((ICollection)_wrapped).SyncRoot; } } bool ICollection.IsReadOnly { get { return true; } } public void CopyTo(TValue[] array, int arrayIndex) { _wrapped.CopyTo(array, arrayIndex); } public IEnumerator GetEnumerator() { return _wrapped.GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_wrapped).CopyTo(array, index); } void ICollection.Add(TValue item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(TValue item) { return _wrapped.Contains(item); } bool ICollection.Remove(TValue item) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } } } #endif