Skip to content

ListPoolScope<T>

Namespace: SideXP.Core | Inherits from: IDisposable, IList<T>

public class ListPoolScope<T> : IDisposable, IList<T>

Gets the instance of a list from ListPool<T>, and release it whenever it's no more used. string[] letters = null; using (var scope = new ListPoolScope{string}()) { scope.List.Add("A"); scope.List.Add("B"); scope.List.Add("C"); letters = scope.List.ToArray(); } UnityEngine.Debug.Log(string.Join(", ", letters));

Type parameters

  • T: The type of the elements of the list.

Constructors

ListPoolScope()

public ListPoolScope()

Gets the instance of a list from ListPool<T>, and release it whenever it's no more used. string[] letters = null; using (var scope = new ListPoolScope{string}()) { scope.List.Add("A"); scope.List.Add("B"); scope.List.Add("C"); letters = scope.List.ToArray(); } UnityEngine.Debug.Log(string.Join(", ", letters));

ListPoolScope(IEnumerable<T>)

public ListPoolScope(IEnumerable<T> collection)

Gets the instance of a list from ListPool<T>, and release it whenever it's no more used. string[] letters = null; using (var scope = new ListPoolScope{string}()) { scope.List.Add("A"); scope.List.Add("B"); scope.List.Add("C"); letters = scope.List.ToArray(); } UnityEngine.Debug.Log(string.Join(", ", letters));

Parameters

  • collection: The initial items in the list

ListPoolScope(int)

public ListPoolScope(int capacity)

Gets the instance of a list from ListPool<T>, and release it whenever it's no more used. string[] letters = null; using (var scope = new ListPoolScope{string}()) { scope.List.Add("A"); scope.List.Add("B"); scope.List.Add("C"); letters = scope.List.ToArray(); } UnityEngine.Debug.Log(string.Join(", ", letters));

Parameters

  • capacity: The initial capacity of the list

Properties

List

public List<T> List

The recycled or created instance of the list.

this[int]

public T this[int index]

Inherited documentation.

Count

public int Count

Inherited documentation.

Capacity

public int Capacity

Inherited documentation.

IsReadOnly

public bool IsReadOnly

Inherited documentation.

Methods

Dispose()

public void Dispose()

Inherited documentation.

Add(T)

public void Add(T item)

Inherited documentation.

AddRange(IEnumerable<T>)

public void AddRange(IEnumerable<T> collection)

Inherited documentation.

AsReadOnly()

public ReadOnlyCollection<T> AsReadOnly()

Inherited documentation.

BinarySearch(int, int, T, IComparer<T>)

public int BinarySearch(int index, int count, T item, IComparer<T> comparer)

Inherited documentation.

BinarySearch(T)

public int BinarySearch(T item)

Inherited documentation.

BinarySearch(T, IComparer<T>)

public int BinarySearch(T item, IComparer<T> comparer)

Inherited documentation.

Clear()

public void Clear()

Inherited documentation.

Contains(T)

public bool Contains(T item)

Inherited documentation.

ConvertAll<TOutput>(Converter<T, TOutput>)

public List<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)

Inherited documentation.

CopyTo(T[], int)

public void CopyTo(T[] array, int arrayIndex)

Inherited documentation.

CopyTo(T[])

public void CopyTo(T[] array)

Inherited documentation.

CopyTo(int, T[], int, int)

public void CopyTo(int index, T[] array, int arrayIndex, int count)

Inherited documentation.

CopyTo(Array, int)

public void CopyTo(Array array, int index)

Inherited documentation.

Exists(Predicate<T>)

public bool Exists(Predicate<T> match)

Inherited documentation.

Find(Predicate<T>)

public T Find(Predicate<T> match)

Inherited documentation.

FindAll(Predicate<T>)

public List<T> FindAll(Predicate<T> match)

Inherited documentation.

FindIndex(int, int, Predicate<T>)

public int FindIndex(int startIndex, int count, Predicate<T> match)

Inherited documentation.

FindIndex(int, Predicate<T>)

public int FindIndex(int startIndex, Predicate<T> match)

Inherited documentation.

FindIndex(Predicate<T>)

public int FindIndex(Predicate<T> match)

Inherited documentation.

FindLast(Predicate<T>)

public T FindLast(Predicate<T> match)

Inherited documentation.

FindLastIndex(int, int, Predicate<T>)

public int FindLastIndex(int startIndex, int count, Predicate<T> match)

Inherited documentation.

FindLastIndex(int, Predicate<T>)

public int FindLastIndex(int startIndex, Predicate<T> match)

Inherited documentation.

FindLastIndex(Predicate<T>)

public int FindLastIndex(Predicate<T> match)

Inherited documentation.

ForEach(Action<T>)

public void ForEach(Action<T> action)

Inherited documentation.

GetRange(int, int)

public List<T> GetRange(int index, int count)

Inherited documentation.

IndexOf(T, int, int)

public int IndexOf(T item, int index, int count)

Inherited documentation.

IndexOf(T, int)

public int IndexOf(T item, int index)

Inherited documentation.

IndexOf(T)

public int IndexOf(T item)

Inherited documentation.

Insert(int, T)

public void Insert(int index, T item)

Inherited documentation.

InsertRange(int, IEnumerable<T>)

public void InsertRange(int index, IEnumerable<T> collection)

Inherited documentation.

LastIndexOf(T)

public int LastIndexOf(T item)

Inherited documentation.

LastIndexOf(T, int)

public int LastIndexOf(T item, int index)

Inherited documentation.

LastIndexOf(T, int, int)

public int LastIndexOf(T item, int index, int count)

Inherited documentation.

Remove(T)

public bool Remove(T item)

Inherited documentation.

RemoveAll(Predicate<T>)

public int RemoveAll(Predicate<T> match)

Inherited documentation.

RemoveAt(int)

public void RemoveAt(int index)

Inherited documentation.

RemoveRange(int, int)

public void RemoveRange(int index, int count)

Inherited documentation.

Reverse(int, int)

public void Reverse(int index, int count)

Inherited documentation.

Reverse()

public void Reverse()

Inherited documentation.

Sort(Comparison<T>)

public void Sort(Comparison<T> comparison)

Inherited documentation.

Sort(int, int, IComparer<T>)

public void Sort(int index, int count, IComparer<T> comparer)

Inherited documentation.

Sort()

public void Sort()

Inherited documentation.

Sort(IComparer<T>)

public void Sort(IComparer<T> comparer)

Inherited documentation.

ToArray()

public T[] ToArray()

Inherited documentation.

TrimExcess()

public void TrimExcess()

Inherited documentation.

TrueForAll(Predicate<T>)

public bool TrueForAll(Predicate<T> match)

Inherited documentation.

GetEnumerator()

public IEnumerator<T> GetEnumerator()

Inherited documentation.