CollectionExtensions.AddRange<T> Method

Definition

Adds the elements of the specified span to the end of the List<T>.

C#
public static void AddRange<T>(this System.Collections.Generic.List<T> list, scoped ReadOnlySpan<T> source);
C#
public static void AddRange<T>(this System.Collections.Generic.List<T> list, ReadOnlySpan<T> source);

Type Parameters

T

The type of elements in the list.

Parameters

list
List<T>

The list to which the elements should be added.

source
ReadOnlySpan<T>

The span whose elements should be added to the end of the List<T>.

Exceptions

The list is null.

Applies to

Product Versions
.NET 8, 9, 10