public interface IItemsCollectionReadOnly { TValue this[TKey Key] { get; } bool ContainsKey( TKey Key ); bool TryGetValue( TKey key, out TValue Value ); bool Contains( KeyValuePair Pair ); void CopyTo( KeyValuePair[] Array, int ArrayIndex ); int Count { get; } bool IsReadOnly { get; } ICollection Keys { get; } ICollection Values { get; } IEnumerator> GetEnumerator(); Item FindItemByPath( string Path ); } public interface IItemsCollection : IItemsCollectionReadOnly { new TValue this[TKey Key] { get; set; } void Add( TKey Key, TValue Value ); void Add( KeyValuePair Pair ); bool Remove( TKey Key ); bool Remove( KeyValuePair Pair ); void Clear(); } /// /// Collection of items /// public class ItemsCollection : IItemsCollection>>, IXmlSerializable { private Dictionary>> items = new Dictionary>>(); public interface IReadOnlyCollection { bool TryGetValue(TKey key, out TValue value); } public class MyCollection : Dictionary, IReadOnlyCollection { } public class MyClass { private MyCollection _myCollection; public IReadOnlyCollection MyCollection { get { return _myCollection; } } private void PrivateMethod() { _myCollection.Add(1, "test"); } } public class SomeClass { private void SomeMethod() { MyClass myClass = new MyClass(); string s; myClass.MyCollection.TryGetValue(1, out s); } }