Struct SubArrayList<T>
- Namespace
- ToolBuddy.Pooling.Collections
A class that simulates very minimal features of a List, but using a SubArray<T> instead of an Array as a storage
public struct SubArrayList<T>
Type Parameters
T- A class that simulates very minimal features of a List, but using a instead of an as a storage
Constructors
SubArrayList(int, ArrayPool<T>)
Creates an instance
public SubArrayList(int initialCapacity, ArrayPool<T> typePool)
Parameters
initialCapacityintThe initial capacity of the underlying storage
typePoolArrayPool<T>A pool that will be used to, if needed, allocate a bigger array if elements
Properties
Array
The Array used by the underlying SubArray<T> for storage
public T[] Array { get; }
Property Value
- T[]
Count
The number of elements occupied in the storage
public readonly int Count { get; }
Property Value
Methods
Add(T)
Adds a new element to the array
public void Add(T element)
Parameters
elementT
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
Equals(SubArrayList<T>)
public bool Equals(SubArrayList<T> other)
Parameters
otherSubArrayList<T>
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToSubArray()
Returns a SubArray<T> instance that will have Array as an array (not a copy of it), and Count as its Count
public SubArray<T> ToSubArray()
Returns
- SubArray<T>
Operators
operator ==(SubArrayList<T>, SubArrayList<T>)
public static bool operator ==(SubArrayList<T> a, SubArrayList<T> b)
Parameters
aSubArrayList<T>bSubArrayList<T>
Returns
operator !=(SubArrayList<T>, SubArrayList<T>)
public static bool operator !=(SubArrayList<T> a, SubArrayList<T> b)
Parameters
aSubArrayList<T>bSubArrayList<T>
Returns
See Also
SubArray<T>