KeyedSortedList<TKey, T> Class
              
              
              Namespace: Stride.Core.Collections
              Assembly: Stride.Core.dll
              
              
              List of items, stored sequentially and sorted by an implicit invariant key that are extracted from items by implementing GetKeyForItem(T).
 
              
              
              
                 System.Object →  
                KeyedSortedList<TKey, T>
              
              
              
              
              
              
                public abstract class KeyedSortedList<TKey, T> : ICollection<T>, IEnumerable<T>, ICollection, IEnumerable
               
              
              Type Parameters
              
                
                  
                    | Name | 
                    Description | 
                  
                
                
                  
                    | TKey | 
                    The type of the key. 
 | 
                  
                  
                    | T | 
                    The type of the item in the collection. 
 | 
                  
                
              
              
              
              
              
                  
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Constructors
              
                
              
              
              
              
              
              KeyedSortedList()
              
              
              
              
              
                protected KeyedSortedList()
               
              
              
              
              
              
              
              KeyedSortedList(IComparer<TKey>)
              
              
              
              
              
                protected KeyedSortedList(IComparer<TKey> comparer)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | System.Collections.Generic.IComparer<TKey> | 
                    comparer | 
                     | 
                  
                
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Fields
              
                
              
              
              
              
              items
              
              
              
              
              
                protected FastListStruct<T> items
               
              
              Field Value
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Properties
              
                
              
              
              
              
              
              Count
              
              
              
              
              
                public int Count { get; }
               
              
              Property Value
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                     | 
                  
                
              
              
              
              
              
              
              Item[TKey]
              
              
              
              
              
                public T this[TKey key] { get; set; }
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | TKey | 
                    key | 
                     | 
                  
                
              
              Property Value
              
              
              
              
              
              
              Item[Int32]
              
              
              
              
              
                public T this[int index] { get; set; }
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                    index | 
                     | 
                  
                
              
              Property Value
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Methods
              
                
              
              
              
              
              
              Add(T)
              
              
              
              
              
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    item | 
                     | 
                  
                
              
              
              
              
              
              
              BinarySearch(TKey)
              
              
              
              
              
                public int BinarySearch(TKey searchKey)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | TKey | 
                    searchKey | 
                     | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                     | 
                  
                
              
              
              
              
              
              
              Clear()
              
              
              
              
              
              
              
              
              
              
              
              Contains(T)
              
              
              
              
              
                public bool Contains(T item)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    item | 
                     | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
              
              
              
              
              
              ContainsKey(TKey)
              
              
              
              
              
                public bool ContainsKey(TKey key)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | TKey | 
                    key | 
                     | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
              
              
              
              
              
              GetEnumerator()
              
              
              
              
              
                public KeyedSortedList<TKey, T>.Enumerator GetEnumerator()
               
              
              Returns
              
              
              
              
              
              
              GetKeyForItem(T)
              
              Extracts the key for the specified element.
 
              
              
              
                protected abstract TKey GetKeyForItem(T item)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    item | 
                    The element from which to extract the key. 
 | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | TKey | 
                    The key for the specified item. 
 | 
                  
                
              
              
              
              
              
              
              IndexOf(T)
              
              
              
              
              
                public int IndexOf(T item)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    item | 
                     | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                     | 
                  
                
              
              
              
              
              
              
              InsertItem(Int32, T)
              
              Called every time an item should be added at a given index.
 
              
              
              
                protected virtual void InsertItem(int index, T item)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                    index | 
                    The index. 
 | 
                  
                  
                    | T | 
                    item | 
                    The item. 
 | 
                  
                
              
              
              
              
              
              
              Remove(TKey)
              
              
              
              
              
                public bool Remove(TKey key)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | TKey | 
                    key | 
                     | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
              
              
              
              
              
              Remove(T)
              
              
              
              
              
                public void Remove(T item)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    item | 
                     | 
                  
                
              
              
              
              
              
              
              RemoveItem(Int32)
              
              Called every time an item should be removed at a given index.
 
              
              
              
                protected virtual void RemoveItem(int index)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | System.Int32 | 
                    index | 
                    The index. 
 | 
                  
                
              
              
              
              
              
              
              Sort()
              
              Sorts again this list (in case keys were mutated).
 
              
              
              
              
              
              
              
              
              
              TryGetValue(TKey, out T)
              
              
              
              
              
                public bool TryGetValue(TKey key, out T value)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | TKey | 
                    key | 
                     | 
                  
                  
                    | T | 
                    value | 
                     | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
                     
              
                
                  |
                  Improve this Doc
                
                
                  View Source
                
              
              
                Explicit Interface Implementations
              
                
              
              
              
              
              
              ICollection<T>.CopyTo(T[], Int32)
              
              
              
              
              
                void ICollection<T>.CopyTo(T[] array, int arrayIndex)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T[] | 
                    array | 
                     | 
                  
                  
                    | System.Int32 | 
                    arrayIndex | 
                     | 
                  
                
              
              
              
              
              
              
              ICollection<T>.IsReadOnly
              
              
              
              
              
                bool ICollection<T>.IsReadOnly { get; }
               
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
              
              
              
              
              
              ICollection<T>.Remove(T)
              
              
              
              
              
                bool ICollection<T>.Remove(T item)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | T | 
                    item | 
                     | 
                  
                
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
              
              
              
              
              
              IEnumerable<T>.GetEnumerator()
              
              
              
              
              
                IEnumerator<T> IEnumerable<T>.GetEnumerator()
               
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Collections.Generic.IEnumerator<T> | 
                     | 
                  
                
              
              
              
              
              
              
              ICollection.CopyTo(Array, Int32)
              
              
              
              
              
                void ICollection.CopyTo(Array array, int arrayIndex)
               
              
              Parameters
              
                
                  
                    | Type | 
                    Name | 
                    Description | 
                  
                
                
                  
                    | System.Array | 
                    array | 
                     | 
                  
                  
                    | System.Int32 | 
                    arrayIndex | 
                     | 
                  
                
              
              
              
              
              
              
              ICollection.IsSynchronized
              
              
              
              
              
                bool ICollection.IsSynchronized { get; }
               
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Boolean | 
                     | 
                  
                
              
              
              
              
              
              
              ICollection.SyncRoot
              
              
              
              
              
                object ICollection.SyncRoot { get; }
               
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Object | 
                     | 
                  
                
              
              
              
              
              
              
              IEnumerable.GetEnumerator()
              
              
              
              
              
                IEnumerator IEnumerable.GetEnumerator()
               
              
              Returns
              
                
                  
                    | Type | 
                    Description | 
                  
                
                
                  
                    | System.Collections.IEnumerator | 
                     | 
                  
                
              
              
              
 
              
               
              
              
              
              
              Extension Methods