ConcurrentStack<T>.PushRange Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
PushRange(T[]) |
Inserts multiple objects at the top of the ConcurrentStack<T> atomically. |
PushRange(T[], Int32, Int32) |
Inserts multiple objects at the top of the ConcurrentStack<T> atomically. |
- Source:
- ConcurrentStack.cs
- Source:
- ConcurrentStack.cs
- Source:
- ConcurrentStack.cs
Inserts multiple objects at the top of the ConcurrentStack<T> atomically.
public:
void PushRange(cli::array <T> ^ items);
public void PushRange (T[] items);
member this.PushRange : 'T[] -> unit
Public Sub PushRange (items As T())
Parameters
- items
- T[]
The objects to push onto the ConcurrentStack<T>.
Exceptions
items
is a null reference (Nothing in Visual Basic).
Remarks
When adding multiple items to the stack, using PushRange is a more efficient mechanism than using Push one item at a time. Additionally, PushRange guarantees that all of the elements will be added atomically, meaning that no other threads will be able to inject elements between the elements being pushed. Items at lower indices in the items
array will be pushed before items at higher indices.
For a code example, see ConcurrentStack<T>.
See also
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
- Source:
- ConcurrentStack.cs
- Source:
- ConcurrentStack.cs
- Source:
- ConcurrentStack.cs
Inserts multiple objects at the top of the ConcurrentStack<T> atomically.
public:
void PushRange(cli::array <T> ^ items, int startIndex, int count);
public void PushRange (T[] items, int startIndex, int count);
member this.PushRange : 'T[] * int * int -> unit
Public Sub PushRange (items As T(), startIndex As Integer, count As Integer)
Parameters
- items
- T[]
The objects to push onto the ConcurrentStack<T>.
- startIndex
- Int32
The zero-based offset in items
at which to begin inserting elements onto the top of the ConcurrentStack<T>.
- count
- Int32
The number of elements to be inserted onto the top of the ConcurrentStack<T>.
Exceptions
items
is a null reference (Nothing in Visual Basic).
startIndex
or count
is negative. Or startIndex
is greater than or equal to the length of items
.
startIndex
+ count
is greater than the length of items
.
Remarks
When adding multiple items to the stack, using PushRange is a more efficient mechanism than using Push one item at a time. Additionally, PushRange guarantees that all of the elements will be added atomically, meaning that no other threads will be able to inject elements between the elements being pushed. Items at lower indices in the items
array will be pushed before items at higher indices.
For a code example, see ConcurrentStack<T>.
See also
Applies to
.NET 9 and other versions
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: