Edit

Share via


ReadOnlyCollection.CreateSet<T>(ReadOnlySpan<T>) Method

Definition

Creates a new ReadOnlySet<T> from the specified span of values.

This method (simplifies collection initialization)[https://free.blessedness.top/dotnet/csharp/language-reference/operators/collection-expressions] to create a new ReadOnlySet<T> with the specified values.

public:
generic <typename T>
 static System::Collections::ObjectModel::ReadOnlySet<T> ^ CreateSet(ReadOnlySpan<T> values);
public static System.Collections.ObjectModel.ReadOnlySet<T> CreateSet<T>(scoped ReadOnlySpan<T> values);
static member CreateSet : ReadOnlySpan<'T> -> System.Collections.ObjectModel.ReadOnlySet<'T>
Public Shared Function CreateSet(Of T) (values As ReadOnlySpan(Of T)) As ReadOnlySet(Of T)

Type Parameters

T

The type of elements in the collection.

Parameters

values
ReadOnlySpan<T>

The span of values to include in the collection.

Returns

A new ReadOnlySet<T> containing the specified values.

Applies to