ReadOnlyKeyedCollection.cs 873 B

1234567891011121314151617181920212223242526272829
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.Runtime
  5. {
  6. using System.Collections.ObjectModel;
  7. class ReadOnlyKeyedCollection<TKey, TValue> : ReadOnlyCollection<TValue>
  8. {
  9. KeyedCollection<TKey, TValue> innerCollection;
  10. public ReadOnlyKeyedCollection(KeyedCollection<TKey, TValue> innerCollection)
  11. : base(innerCollection)
  12. {
  13. Fx.Assert(innerCollection != null, "innerCollection should not be null");
  14. this.innerCollection = innerCollection;
  15. }
  16. public TValue this[TKey key]
  17. {
  18. get
  19. {
  20. return this.innerCollection[key];
  21. }
  22. }
  23. }
  24. }