-
Notifications
You must be signed in to change notification settings - Fork 8
Array reallocation
zmjack edited this page Jun 12, 2023
·
1 revision
Reallocates storage space for an array variable.
Example 1 ( Shrink space )
var d2 = new int[3, 3]
{
{ 0, 1, 2 },
{ 3, 4, 5 },
{ 6, 7, 8 }
};
Any.ReDim(ref d2, 2, 2);
for (int i = 0; i < d2.GetLength(0); i++)
{
var row = new int[d2.GetLength(1)].Let(j => d2[i, j]);
Console.WriteLine(row.Join(", "));
}0, 1
3, 4
Example 2 ( Expand space )
var d2 = new int[3, 3]
{
{ 0, 1, 2 },
{ 3, 4, 5 },
{ 6, 7, 8 }
};
Any.ReDim(ref d2, 4, 4);
for (int i = 0; i < d2.GetLength(0); i++)
{
var row = new int[d2.GetLength(1)].Let(j => d2[i, j]);
Console.WriteLine(row.Join(", "));
}0, 1, 2, 0
3, 4, 5, 0
6, 7, 8, 0
0, 0, 0, 0
![]() |
![]() |
||
|---|---|---|---|
| English | 中文 |
- Array initialization
- Array mapping
- Array reallocation
- Chain loop
- Compose / Pipeline
- Date & Time
- Flat elements
- Index-Value Pairs
- Traverse by depth
- Zip sequences
- [Come soon] Counter
- DP container
- Evaluator
- Fixed size queue
- Scope
- Sequence input stream
- Sliding
- State
- Value with unit
- Variant string

