CollectionNavigator.cs 929 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. namespace Terminal.Gui;
  3. /// <inheritdoc/>
  4. /// <remarks>This implementation is based on a static <see cref="Collection"/> of objects.</remarks>
  5. public class CollectionNavigator : CollectionNavigatorBase
  6. {
  7. /// <summary>Constructs a new CollectionNavigator.</summary>
  8. public CollectionNavigator () { }
  9. /// <summary>Constructs a new CollectionNavigator for the given collection.</summary>
  10. /// <param name="collection"></param>
  11. public CollectionNavigator (IList collection) { Collection = collection; }
  12. /// <summary>The collection of objects to search. <see cref="object.ToString()"/> is used to search the collection.</summary>
  13. public IList Collection { get; set; }
  14. /// <inheritdoc/>
  15. protected override object ElementAt (int idx) { return Collection [idx]; }
  16. /// <inheritdoc/>
  17. protected override int GetCollectionLength () { return Collection.Count; }
  18. }