#nullable disable using System.Collections; namespace Terminal.Gui.Views; /// /// This implementation is based on a static of objects. internal class CollectionNavigator : CollectionNavigatorBase, IListCollectionNavigator { private readonly object _collectionLock = new (); private IList _collection; /// Constructs a new CollectionNavigator. public CollectionNavigator () { } /// Constructs a new CollectionNavigator for the given collection. /// public CollectionNavigator (IList collection) { Collection = collection; } /// public IList Collection { get { lock (_collectionLock) { return _collection; } } set { lock (_collectionLock) { _collection = value; } } } /// protected override object ElementAt (int idx) { lock (_collectionLock) { return Collection [idx]; } } /// protected override int GetCollectionLength () { lock (_collectionLock) { return Collection.Count; } } }