ReadOnlyCollectionBuilder<T>.ToReadOnlyCollection 方法

定义

创建一个包含 ReadOnlyCollection<T> 的所有元素的 ReadOnlyCollectionBuilder<T>,避免将元素复制到新数组(如果可能)。Creates a ReadOnlyCollection<T> containing all of the elements of the ReadOnlyCollectionBuilder<T>, avoiding copying the elements to the new array if possible. 创建 ReadOnlyCollectionBuilder<T> 后重置 ReadOnlyCollection<T>Resets the ReadOnlyCollectionBuilder<T> after the ReadOnlyCollection<T> has been created.

public:
 System::Collections::ObjectModel::ReadOnlyCollection<T> ^ ToReadOnlyCollection();
public System.Collections.ObjectModel.ReadOnlyCollection<T> ToReadOnlyCollection ();
member this.ToReadOnlyCollection : unit -> System.Collections.ObjectModel.ReadOnlyCollection<'T>
Public Function ToReadOnlyCollection () As ReadOnlyCollection(Of T)

返回

适用于