ObjectCollectionBase.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System.Collections;
  2. namespace System.Windows.Forms
  3. {
  4. public class ObjectCollectionBase : WrappedCollection
  5. {
  6. protected internal IList items;
  7. protected override IList InnerList => items;
  8. public object this[int index]
  9. {
  10. get => items[index];
  11. set => items[index] = value;
  12. }
  13. public int Add(object obj) => items.Add(obj);
  14. public void AddRange(object[] objects)
  15. {
  16. foreach (object obj in objects)
  17. Add(obj);
  18. }
  19. public void Insert(int index, object obj) => items.Insert(index, obj);
  20. public void Remove(object obj) => items.Remove(obj);
  21. public void RemoveAt(int index) => items.RemoveAt(index);
  22. public void Clear() => items.Clear();
  23. public int IndexOf(object obj) => items.IndexOf(obj);
  24. public bool Contains(object obj) => items.Contains(obj);
  25. internal ObjectCollectionBase(IList items)
  26. {
  27. this.items = items;
  28. }
  29. }
  30. }