Edit

Share via


CollectionsExtensions.ToReadOnlyCollection<TElement> Method

Definition

Creates a read-only copy of an existing collection.

public:
generic <typename TElement>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::ObjectModel::ReadOnlyCollection<TElement> ^ ToReadOnlyCollection(System::Collections::Generic::IEnumerable<TElement> ^ elements);
public static System.Collections.ObjectModel.ReadOnlyCollection<TElement> ToReadOnlyCollection<TElement> (this System.Collections.Generic.IEnumerable<TElement> elements);
static member ToReadOnlyCollection : seq<'Element> -> System.Collections.ObjectModel.ReadOnlyCollection<'Element>
<Extension()>
Public Function ToReadOnlyCollection(Of TElement) (elements As IEnumerable(Of TElement)) As ReadOnlyCollection(Of TElement)

Type Parameters

TElement

The type of element in the collection.

Parameters

elements
IEnumerable<TElement>

The collection to be copied.

Returns

ReadOnlyCollection<TElement>

The new, read-only copy of elements.

Applies to