mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 10:08:00 +02:00
Corlib helper methods
This commit is contained in:
parent
6eddf12948
commit
74b73e5dc8
5 changed files with 116 additions and 2 deletions
|
@ -551,6 +551,14 @@ namespace System.Collections
|
|||
mSize = (.)size;
|
||||
}
|
||||
|
||||
public void Resize(int newSize, T fillValue)
|
||||
{
|
||||
let prevSize = mSize;
|
||||
Count = newSize;
|
||||
for (int i = prevSize; i < newSize; i++)
|
||||
mItems[i] = fillValue;
|
||||
}
|
||||
|
||||
public Enumerator GetEnumerator()
|
||||
{
|
||||
return Enumerator(this);
|
||||
|
@ -636,6 +644,19 @@ namespace System.Collections
|
|||
return -1;
|
||||
}
|
||||
|
||||
public void Set(Span<T> span)
|
||||
{
|
||||
Count = span.Length;
|
||||
for (int i < mSize)
|
||||
mItems[i] = span[i];
|
||||
}
|
||||
|
||||
public void SetAll(T value)
|
||||
{
|
||||
for (int i < mSize)
|
||||
mItems[i] = value;
|
||||
}
|
||||
|
||||
public void Insert(int index, T item)
|
||||
{
|
||||
var item; // This creates a copy - required if item is a ref to an element
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue