Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
GrowingArray.cs
Go to the documentation of this file.
1
namespace
System.Linq.Parallel
;
2
3
internal
sealed
class
GrowingArray
<T>
4
{
5
private
T[]
_array
;
6
7
private
int
_count
;
8
9
internal
T[]
InternalArray
=>
_array
;
10
11
internal
GrowingArray
()
12
{
13
_array
=
new
T[1024];
14
_count
= 0;
15
}
16
17
internal
void
Add
(T element)
18
{
19
if
(
_count
>=
_array
.Length)
20
{
21
GrowArray
(2 *
_array
.Length);
22
}
23
_array
[
_count
++] = element;
24
}
25
26
private
void
GrowArray
(
int
newSize
)
27
{
28
T[]
array
=
new
T[
newSize
];
29
_array
.CopyTo(
array
, 0);
30
_array
=
array
;
31
}
32
33
internal
void
CopyFrom
(T[] otherArray,
int
otherCount)
34
{
35
if
(
_count
+ otherCount >
_array
.Length)
36
{
37
GrowArray
(
_count
+ otherCount);
38
}
39
Array
.
Copy
(otherArray, 0,
_array
,
_count
, otherCount);
40
_count
+= otherCount;
41
}
42
}
System.Array.Copy
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition
Array.cs:624
System.Array
Definition
Array.cs:16
System.Linq.Parallel.GrowingArray._array
T[] _array
Definition
GrowingArray.cs:5
System.Linq.Parallel.GrowingArray.GrowingArray
GrowingArray()
Definition
GrowingArray.cs:11
System.Linq.Parallel.GrowingArray.GrowArray
void GrowArray(int newSize)
Definition
GrowingArray.cs:26
System.Linq.Parallel.GrowingArray._count
int _count
Definition
GrowingArray.cs:7
System.Linq.Parallel.GrowingArray.InternalArray
T[] InternalArray
Definition
GrowingArray.cs:9
System.Linq.Parallel.GrowingArray.Add
void Add(T element)
Definition
GrowingArray.cs:17
System.Linq.Parallel.GrowingArray.CopyFrom
void CopyFrom(T[] otherArray, int otherCount)
Definition
GrowingArray.cs:33
System.Linq.Parallel.GrowingArray
Definition
GrowingArray.cs:4
System.Linq.Parallel
Definition
AnyAllSearchOperator.cs:5
System.ExceptionArgument.newSize
@ newSize
System.ExceptionArgument.array
@ array
source
System.Linq.Parallel
System.Linq.Parallel
GrowingArray.cs
Generated by
1.10.0