FastCollection<T> Class
Namespace: Stride.Core.Collections
Assembly: Stride.Core.dll
Faster and lighter implementation of System.Collections.ObjectModel.Collection<T> with value types enumerators to avoid allocation in foreach loops, and various helper functions.
System.Object →
FastCollection<T>
[DataSerializer(typeof(ListAllSerializer<, >), Mode = DataSerializerGenericMode.TypeAndGenericArguments)]
public class FastCollection<T> : IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
Name |
Description |
T |
Type of elements of this collection
|
|
Improve this Doc
View Source
Constructors
FastCollection()
FastCollection(IEnumerable<T>)
public FastCollection(IEnumerable<T> collection)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<T> |
collection |
|
FastCollection(Int32)
public FastCollection(int capacity)
Parameters
Type |
Name |
Description |
System.Int32 |
capacity |
|
|
Improve this Doc
View Source
Properties
Capacity
public int Capacity { get; set; }
Property Value
Type |
Description |
System.Int32 |
|
Count
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Item[Int32]
Gets or sets the element at the specified index.
public T this[int index] { get; set; }
Parameters
Type |
Name |
Description |
System.Int32 |
index |
The index.
|
Property Value
Type |
Description |
T |
The element .
|
Exceptions
Type |
Condition |
System.ArgumentOutOfRangeException |
If index is out of range
|
|
Improve this Doc
View Source
Methods
Add(T)
Parameters
Type |
Name |
Description |
T |
item |
|
AddRange<TE>(TE)
public void AddRange<TE>(TE itemsArgs)
where TE : IEnumerable<T>
Parameters
Type |
Name |
Description |
TE |
itemsArgs |
The items to add to this collection.
|
Type Parameters
Clear()
ClearItems()
protected virtual void ClearItems()
Contains(T)
public bool Contains(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Boolean |
|
CopyTo(T[], Int32)
public void CopyTo(T[] array, int arrayIndex)
Parameters
Type |
Name |
Description |
T[] |
array |
|
System.Int32 |
arrayIndex |
|
EnsureCapacity(Int32)
public void EnsureCapacity(int min)
Parameters
Type |
Name |
Description |
System.Int32 |
min |
|
GetEnumerator()
Inline Enumerator used directly by foreach.
public FastCollection<T>.Enumerator GetEnumerator()
Returns
IndexOf(T)
public int IndexOf(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Int32 |
|
Insert(Int32, T)
public void Insert(int index, T item)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
T |
item |
|
InsertItem(Int32, T)
protected virtual void InsertItem(int index, T item)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
T |
item |
|
Remove(T)
public bool Remove(T item)
Parameters
Type |
Name |
Description |
T |
item |
|
Returns
Type |
Description |
System.Boolean |
|
RemoveAt(Int32)
public void RemoveAt(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
RemoveItem(Int32)
protected virtual void RemoveItem(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
SetItem(Int32, T)
protected virtual void SetItem(int index, T item)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
T |
item |
|
Sort()
Sort(IComparer<T>)
public void Sort(IComparer<T> comparer)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IComparer<T> |
comparer |
|
Sort(Int32, Int32, IComparer<T>)
public void Sort(int index, int count, IComparer<T> comparer)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
|
System.Int32 |
count |
|
System.Collections.Generic.IComparer<T> |
comparer |
|
|
Improve this Doc
View Source
Explicit Interface Implementations
ICollection<T>.IsReadOnly
bool ICollection<T>.IsReadOnly { get; }
Returns
Type |
Description |
System.Boolean |
|
IEnumerable<T>.GetEnumerator()
IEnumerator<T> IEnumerable<T>.GetEnumerator()
Returns
Type |
Description |
System.Collections.Generic.IEnumerator<T> |
|
IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
Returns
Type |
Description |
System.Collections.IEnumerator |
|
Extension Methods