Beef Corlib
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
System.Collections.List< T > Class Template Reference
Inheritance diagram for System.Collections.List< T >:
System.Collections.IEnumerable< T > System.Collections.IList System.Collections.ICollection< T > System.Collections.ListWithAlloc< T >

Classes

struct  Enumerator
 

Public Member Functions

 List (IEnumerator< T > enumerator)
 
 List (Span< T > span)
 
 List (int capacity)
 
void Add (T item)
 Adds an item to the back of the list.
 
void AddFront (T item)
 Adds an item to the front of the list.
 
void AddRange (Span< T > addSpan)
 Adds an item to the back of the list.
 
void AddRange (IEnumerator< T > items)
 
void AddRange< TEnumable > (TEnumable items)
 
Span< T > GetRange (int offset)
 
Span< T > GetRange (int offset, int count)
 
T * GrowUnitialized (int addSize)
 Returns a pointer to the start of the added uninitialized section.
 
void Clear ()
 
bool Contains (T item)
 
bool ContainsStrict (T item)
 
bool ContainsAlt< TAlt > (TAlt item)
 
void CopyTo (T[] array)
 
void CopyTo (List< T > destList)
 
void CopyTo (Span< T > span)
 
void CopyTo (T[] array, int arrayIndex)
 
void CopyTo (int index, T[] array, int arrayIndex, int count)
 
T * EnsureCapacity (int min, bool autoFree)
 
void Reserve (int size)
 
void Resize (int size)
 
void Resize (int newSize, T fillValue)
 
Enumerator GetEnumerator ()
 
int FindIndex (Predicate< T > match)
 
int IndexOf (T item)
 
int IndexOf (T item, int index)
 
int IndexOf (T item, int index, int count)
 
int IndexOfStrict (T item)
 
int IndexOfStrict (T item, int index)
 
int IndexOfStrict (T item, int index, int count)
 
int IndexOfAlt< TAlt > (TAlt item)
 
int LastIndexOf (T item)
 
int LastIndexOfStrict (T item)
 
void Set (Span< T > span)
 
void SetAll (T value)
 
void Insert (int index, T item)
 
void Insert (int index, Span< T > items)
 
void RemoveAt (int index)
 
void RemoveRange (int index, int count)
 
void RemoveAtFast (int index)
 Will change the order of items in the list.
 
void RemoveRangeFast (int index, int count)
 Will change the order of items in the list.
 
void Sort (Comparison< T > comp)
 
void Sort (Comparison< T > comp, int index, int count)
 
int RemoveAll (Predicate< T > match)
 
PopBack ()
 
PopBack ()
 
PopFront ()
 
PopFront ()
 
bool Remove (T item)
 
bool RemoveStrict (T item)
 
bool RemoveAlt< TAlt > (TAlt item)
 
Result< T > GetAndRemove (T item)
 
Result< T > GetAndRemoveStrict (T item)
 
Result< T > GetAndRemoveAlt< TAlt > (TAlt item)
 
int BinarySearch (T item, delegate int(T lhs, T rhs) comparer)
 The method returns the index of the given value in the list. More...
 
int BinarySearchAlt< TAlt > (TAlt item, delegate int(T lhs, TAlt rhs) comparer)
 
int BinarySearch (int index, int count, T item, delegate int(T lhs, T rhs) comparer)
 

Static Public Member Functions

static operator Span< T > (List< T > list)
 

Protected Member Functions

virtual T * Alloc (int size)
 
virtual void Free (T *val)
 
override void GCMarkMembers ()
 

Properties

int AllocSize [get]
 
bool IsDynAlloc [get]
 
T * Ptr [get]
 
int Capacity [get, set]
 
int Count [get, set]
 
bool IsEmpty [get]
 
ref T this[int index] [get, set]
 
ref T this[Index index] [get, set]
 
Span< T > this[IndexRange range] [get]
 
ref T Front [get]
 
ref T Back [get]
 
- Properties inherited from System.Collections.IList
Variant this[int index] [get, set]
 
- Properties inherited from System.Collections.ICollection< T >
abstract int Count [get]
 

Member Function Documentation

◆ BinarySearch()

int System.Collections.List< T >.BinarySearch ( item,
delegate int(T lhs, T rhs)  comparer 
)
inline

The method returns the index of the given value in the list.

If the list does not contain the given value, the method returns a negative integer. The bitwise complement operator (~) can be applied to a negative result to produce the index of the first element (if any) that is larger than the given search value. This is also the index at which the search value should be inserted into the list in order for the list to remain sorted.

The method uses the Array.BinarySearch method to perform the search.

Searches a section of the list for a given element using a binary search algorithm.