.NET Framework Class Library
ReadOnlyCollectionT Class

Provides the base class for a generic read-only collection.

Namespace:   System.Collections.ObjectModel
Assembly:  mscorlib (in mscorlib.dll)
Syntax
<[%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_0%]> _
<[%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_1%](False)> _
<[%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_2%]("Count = {Count}")> _
Public Class ReadOnlyCollection(Of T) _
	Implements [%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_3%](Of T), [%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_4%](Of T),  _
	[%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_5%](Of T), [%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_6%], [%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_7%], [%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_8%], [%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_9%](Of T),  _
	[%$TOPIC/ms132474_en-us_VS_110_2_0_0_0_10%](Of T)
[[%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_0%]]
[[%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_1%](false)]
[[%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_2%]("Count = {Count}")]
public class ReadOnlyCollection<T> : [%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_3%]<T>, 
	[%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_4%]<T>, [%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_5%]<T>, [%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_6%], [%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_7%], [%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_8%], 
	[%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_9%]<T>, [%$TOPIC/ms132474_en-us_VS_110_2_0_1_0_10%]<T>
[[%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_0%]]
[[%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_1%](false)]
[[%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_2%](L"Count = {Count}")]
generic<typename T>
public ref class ReadOnlyCollection : [%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_3%]<T>, 
	[%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_4%]<T>, [%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_5%]<T>, [%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_6%], [%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_7%], [%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_8%], 
	[%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_9%]<T>, [%$TOPIC/ms132474_en-us_VS_110_2_0_2_0_10%]<T>
[<[%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_0%]>]
[<[%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_1%](false)>]
[<[%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_2%]("Count = {Count}")>]
type ReadOnlyCollection<'T> =  
    class 
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_3%]<'T>
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_4%]<'T>
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_5%]<'T>
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_6%] 
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_7%] 
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_8%] 
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_9%]<'T>
        interface [%$TOPIC/ms132474_en-us_VS_110_2_0_3_0_10%]<'T>
    end
JScript does not support generic types or methods.

Type Parameters

T

The type of elements in the collection.

The ReadOnlyCollectionT type exposes the following members.

Constructors
  NameDescription
Public method Supported by the XNA Framework Supported by Portable Class Library ReadOnlyCollectionTInitializes a new instance of the ReadOnlyCollectionT class that is a read-only wrapper around the specified list.
Top
Properties
  NameDescription
Public property Supported by the XNA Framework Supported by Portable Class Library CountGets the number of elements contained in the ReadOnlyCollectionT instance.
Public property Supported by the XNA Framework Supported by Portable Class Library ItemGets the element at the specified index.
Protected property Supported by the XNA Framework Supported by Portable Class Library ItemsReturns the IListT that the ReadOnlyCollectionT wraps.
Top
Methods
  NameDescription
Public method Supported by the XNA Framework Supported by Portable Class Library ContainsDetermines whether an element is in the ReadOnlyCollectionT.
Public method Supported by the XNA Framework Supported by Portable Class Library CopyToCopies the entire ReadOnlyCollectionT to a compatible one-dimensional Array, starting at the specified index of the target array.
Public method Supported by the XNA Framework Supported by Portable Class Library Equals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Supported by the XNA Framework Supported by Portable Class Library FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method Supported by the XNA Framework Supported by Portable Class Library GetEnumeratorReturns an enumerator that iterates through the ReadOnlyCollectionT.
Public method Supported by the XNA Framework Supported by Portable Class Library GetHashCodeServes as the default hash function. (Inherited from Object.)
Public method Supported by the XNA Framework Supported by Portable Class Library GetTypeGets the Type of the current instance. (Inherited from Object.)
Public method Supported by the XNA Framework Supported by Portable Class Library IndexOfSearches for the specified object and returns the zero-based index of the first occurrence within the entire ReadOnlyCollectionT.
Protected method Supported by the XNA Framework Supported by Portable Class Library MemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public method Supported by the XNA Framework Supported by Portable Class Library ToStringReturns a string that represents the current object. (Inherited from Object.)
Top
Extension Methods
  NameDescription
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AggregateT(FuncT, T, T)Overloaded. Applies an accumulator function over a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AggregateT, TAccumulate(TAccumulate, FuncTAccumulate, T, TAccumulate)Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AggregateT, TAccumulate, TResult(TAccumulate, FuncTAccumulate, T, TAccumulate, FuncTAccumulate, TResult)Overloaded. Applies an accumulator function over a sequence. The specified seed value is used as the initial accumulator value, and the specified function is used to select the result value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AllTDetermines whether all elements of a sequence satisfy a condition. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AnyTOverloaded. Determines whether a sequence contains any elements. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AnyT(FuncT, Boolean)Overloaded. Determines whether any element of a sequence satisfies a condition. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AsEnumerableTReturns the input typed as IEnumerableT. (Defined by Enumerable.)
Public Extension Method Supported by Portable Class Library AsParallelOverloaded. Enables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension Method Supported by Portable Class Library AsParallelTOverloaded. Enables parallelization of a query. (Defined by ParallelEnumerable.)
Public Extension Method Supported by Portable Class Library AsQueryableOverloaded. Converts an IEnumerable to an IQueryable. (Defined by Queryable.)
Public Extension Method Supported by Portable Class Library AsQueryableTOverloaded. Converts a generic IEnumerableT to a generic IQueryableT. (Defined by Queryable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, Decimal)Overloaded. Computes the average of a sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, NullableDecimal)Overloaded. Computes the average of a sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, Double)Overloaded. Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, NullableDouble)Overloaded. Computes the average of a sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, Int32)Overloaded. Computes the average of a sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, NullableInt32)Overloaded. Computes the average of a sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, Int64)Overloaded. Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, NullableInt64)Overloaded. Computes the average of a sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, Single)Overloaded. Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library AverageT(FuncT, NullableSingle)Overloaded. Computes the average of a sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library CastTResultCasts the elements of an IEnumerable to the specified type. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ConcatTConcatenates two sequences. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ContainsT(T)Overloaded. Determines whether a sequence contains a specified element by using the default equality comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ContainsT(T, IEqualityComparerT)Overloaded. Determines whether a sequence contains a specified element by using a specified IEqualityComparerT. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library CountTOverloaded. Returns the number of elements in a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library CountT(FuncT, Boolean)Overloaded. Returns a number that represents how many elements in the specified sequence satisfy a condition. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library DefaultIfEmptyTOverloaded. Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the sequence is empty. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library DefaultIfEmptyT(T)Overloaded. Returns the elements of the specified sequence or the specified value in a singleton collection if the sequence is empty. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library DistinctTOverloaded. Returns distinct elements from a sequence by using the default equality comparer to compare values. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library DistinctT(IEqualityComparerT)Overloaded. Returns distinct elements from a sequence by using a specified IEqualityComparerT to compare values. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ElementAtTReturns the element at a specified index in a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ElementAtOrDefaultTReturns the element at a specified index in a sequence or a default value if the index is out of range. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ExceptT(IEnumerableT)Overloaded. Produces the set difference of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ExceptT(IEnumerableT, IEqualityComparerT)Overloaded. Produces the set difference of two sequences by using the specified IEqualityComparerT to compare values. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library FirstTOverloaded. Returns the first element of a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library FirstT(FuncT, Boolean)Overloaded. Returns the first element in a sequence that satisfies a specified condition. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library FirstOrDefaultTOverloaded. Returns the first element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library FirstOrDefaultT(FuncT, Boolean)Overloaded. Returns the first element of the sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey(FuncT, TKey)Overloaded. Groups the elements of a sequence according to a specified key selector function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey(FuncT, TKey, IEqualityComparerTKey)Overloaded. Groups the elements of a sequence according to a specified key selector function and compares the keys by using a specified comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey, TElement(FuncT, TKey, FuncT, TElement)Overloaded. Groups the elements of a sequence according to a specified key selector function and projects the elements for each group by using a specified function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey, TResult(FuncT, TKey, FuncTKey, IEnumerableT, TResult)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey, TElement(FuncT, TKey, FuncT, TElement, IEqualityComparerTKey)Overloaded. Groups the elements of a sequence according to a key selector function. The keys are compared by using a comparer and each group's elements are projected by using a specified function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey, TResult(FuncT, TKey, FuncTKey, IEnumerableT, TResult, IEqualityComparerTKey)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The keys are compared by using a specified comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey, TElement, TResult(FuncT, TKey, FuncT, TElement, FuncTKey, IEnumerableTElement, TResult)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. The elements of each group are projected by using a specified function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupByT, TKey, TElement, TResult(FuncT, TKey, FuncT, TElement, FuncTKey, IEnumerableTElement, TResult, IEqualityComparerTKey)Overloaded. Groups the elements of a sequence according to a specified key selector function and creates a result value from each group and its key. Key values are compared by using a specified comparer, and the elements of each group are projected by using a specified function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupJoinT, TInner, TKey, TResult(IEnumerableTInner, FuncT, TKey, FuncTInner, TKey, FuncT, IEnumerableTInner, TResult)Overloaded. Correlates the elements of two sequences based on equality of keys and groups the results. The default equality comparer is used to compare keys. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library GroupJoinT, TInner, TKey, TResult(IEnumerableTInner, FuncT, TKey, FuncTInner, TKey, FuncT, IEnumerableTInner, TResult, IEqualityComparerTKey)Overloaded. Correlates the elements of two sequences based on key equality and groups the results. A specified IEqualityComparerT is used to compare keys. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library IntersectT(IEnumerableT)Overloaded. Produces the set intersection of two sequences by using the default equality comparer to compare values. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library IntersectT(IEnumerableT, IEqualityComparerT)Overloaded. Produces the set intersection of two sequences by using the specified IEqualityComparerT to compare values. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library JoinT, TInner, TKey, TResult(IEnumerableTInner, FuncT, TKey, FuncTInner, TKey, FuncT, TInner, TResult)Overloaded. Correlates the elements of two sequences based on matching keys. The default equality comparer is used to compare keys. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library JoinT, TInner, TKey, TResult(IEnumerableTInner, FuncT, TKey, FuncTInner, TKey, FuncT, TInner, TResult, IEqualityComparerTKey)Overloaded. Correlates the elements of two sequences based on matching keys. A specified IEqualityComparerT is used to compare keys. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library LastTOverloaded. Returns the last element of a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library LastT(FuncT, Boolean)Overloaded. Returns the last element of a sequence that satisfies a specified condition. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library LastOrDefaultTOverloaded. Returns the last element of a sequence, or a default value if the sequence contains no elements. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library LastOrDefaultT(FuncT, Boolean)Overloaded. Returns the last element of a sequence that satisfies a condition or a default value if no such element is found. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library LongCountTOverloaded. Returns an Int64 that represents the total number of elements in a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library LongCountT(FuncT, Boolean)Overloaded. Returns an Int64 that represents how many elements in a sequence satisfy a condition. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxTOverloaded. Returns the maximum value in a generic sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, Decimal)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Decimal value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, NullableDecimal)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Decimal value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, Double)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Double value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, NullableDouble)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Double value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, Int32)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int32 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, NullableInt32)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int32 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, Int64)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Int64 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, NullableInt64)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Int64 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, Single)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum Single value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT(FuncT, NullableSingle)Overloaded. Invokes a transform function on each element of a sequence and returns the maximum nullable Single value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MaxT, TResult(FuncT, TResult)Overloaded. Invokes a transform function on each element of a generic sequence and returns the maximum resulting value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinTOverloaded. Returns the minimum value in a generic sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, Decimal)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Decimal value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, NullableDecimal)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Decimal value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, Double)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Double value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, NullableDouble)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Double value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, Int32)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int32 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, NullableInt32)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int32 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, Int64)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Int64 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, NullableInt64)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Int64 value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, Single)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum Single value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT(FuncT, NullableSingle)Overloaded. Invokes a transform function on each element of a sequence and returns the minimum nullable Single value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library MinT, TResult(FuncT, TResult)Overloaded. Invokes a transform function on each element of a generic sequence and returns the minimum resulting value. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library OfTypeTResultFilters the elements of an IEnumerable based on a specified type. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library OrderByT, TKey(FuncT, TKey)Overloaded. Sorts the elements of a sequence in ascending order according to a key. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library OrderByT, TKey(FuncT, TKey, IComparerTKey)Overloaded. Sorts the elements of a sequence in ascending order by using a specified comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library OrderByDescendingT, TKey(FuncT, TKey)Overloaded. Sorts the elements of a sequence in descending order according to a key. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library OrderByDescendingT, TKey(FuncT, TKey, IComparerTKey)Overloaded. Sorts the elements of a sequence in descending order by using a specified comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ReverseTInverts the order of the elements in a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SelectT, TResult(FuncT, TResult)Overloaded. Projects each element of a sequence into a new form. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SelectT, TResult(FuncT, Int32, TResult)Overloaded. Projects each element of a sequence into a new form by incorporating the element's index. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SelectManyT, TResult(FuncT, IEnumerableTResult)Overloaded. Projects each element of a sequence to an IEnumerableT and flattens the resulting sequences into one sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SelectManyT, TResult(FuncT, Int32, IEnumerableTResult)Overloaded. Projects each element of a sequence to an IEnumerableT, and flattens the resulting sequences into one sequence. The index of each source element is used in the projected form of that element. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SelectManyT, TCollection, TResult(FuncT, Int32, IEnumerableTCollection, FuncT, TCollection, TResult)Overloaded. Projects each element of a sequence to an IEnumerableT, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. The index of each source element is used in the intermediate projected form of that element. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SelectManyT, TCollection, TResult(FuncT, IEnumerableTCollection, FuncT, TCollection, TResult)Overloaded. Projects each element of a sequence to an IEnumerableT, flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SequenceEqualT(IEnumerableT)Overloaded. Determines whether two sequences are equal by comparing the elements by using the default equality comparer for their type. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SequenceEqualT(IEnumerableT, IEqualityComparerT)Overloaded. Determines whether two sequences are equal by comparing their elements by using a specified IEqualityComparerT. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SingleTOverloaded. Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SingleT(FuncT, Boolean)Overloaded. Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SingleOrDefaultTOverloaded. Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SingleOrDefaultT(FuncT, Boolean)Overloaded. Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SkipTBypasses a specified number of elements in a sequence and then returns the remaining elements. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SkipWhileT(FuncT, Boolean)Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SkipWhileT(FuncT, Int32, Boolean)Overloaded. Bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. The element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, Decimal)Overloaded. Computes the sum of the sequence of Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, NullableDecimal)Overloaded. Computes the sum of the sequence of nullable Decimal values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, Double)Overloaded. Computes the sum of the sequence of Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, NullableDouble)Overloaded. Computes the sum of the sequence of nullable Double values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, Int32)Overloaded. Computes the sum of the sequence of Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, NullableInt32)Overloaded. Computes the sum of the sequence of nullable Int32 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, Int64)Overloaded. Computes the sum of the sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, NullableInt64)Overloaded. Computes the sum of the sequence of nullable Int64 values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, Single)Overloaded. Computes the sum of the sequence of Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library SumT(FuncT, NullableSingle)Overloaded. Computes the sum of the sequence of nullable Single values that are obtained by invoking a transform function on each element of the input sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library TakeTReturns a specified number of contiguous elements from the start of a sequence. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library TakeWhileT(FuncT, Boolean)Overloaded. Returns elements from a sequence as long as a specified condition is true. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library TakeWhileT(FuncT, Int32, Boolean)Overloaded. Returns elements from a sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToArrayTCreates an array from a IEnumerableT. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToDictionaryT, TKey(FuncT, TKey)Overloaded. Creates a DictionaryTKey, TValue from an IEnumerableT according to a specified key selector function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToDictionaryT, TKey(FuncT, TKey, IEqualityComparerTKey)Overloaded. Creates a DictionaryTKey, TValue from an IEnumerableT according to a specified key selector function and key comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToDictionaryT, TKey, TElement(FuncT, TKey, FuncT, TElement)Overloaded. Creates a DictionaryTKey, TValue from an IEnumerableT according to specified key selector and element selector functions. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToDictionaryT, TKey, TElement(FuncT, TKey, FuncT, TElement, IEqualityComparerTKey)Overloaded. Creates a DictionaryTKey, TValue from an IEnumerableT according to a specified key selector function, a comparer, and an element selector function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToListTCreates a ListT from an IEnumerableT. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToLookupT, TKey(FuncT, TKey)Overloaded. Creates a LookupTKey, TElement from an IEnumerableT according to a specified key selector function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToLookupT, TKey(FuncT, TKey, IEqualityComparerTKey)Overloaded. Creates a LookupTKey, TElement from an IEnumerableT according to a specified key selector function and key comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToLookupT, TKey, TElement(FuncT, TKey, FuncT, TElement)Overloaded. Creates a LookupTKey, TElement from an IEnumerableT according to specified key selector and element selector functions. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library ToLookupT, TKey, TElement(FuncT, TKey, FuncT, TElement, IEqualityComparerTKey)Overloaded. Creates a LookupTKey, TElement from an IEnumerableT according to a specified key selector function, a comparer and an element selector function. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library UnionT(IEnumerableT)Overloaded. Produces the set union of two sequences by using the default equality comparer. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library UnionT(IEnumerableT, IEqualityComparerT)Overloaded. Produces the set union of two sequences by using a specified IEqualityComparerT. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library WhereT(FuncT, Boolean)Overloaded. Filters a sequence of values based on a predicate. (Defined by Enumerable.)
Public Extension Method Supported by the XNA Framework Supported by Portable Class Library WhereT(FuncT, Int32, Boolean)Overloaded. Filters a sequence of values based on a predicate. Each element's index is used in the logic of the predicate function. (Defined by Enumerable.)
Public Extension Method Supported by Portable Class Library ZipT, TSecond, TResultApplies a specified function to the corresponding elements of two sequences, producing a sequence of the results. (Defined by Enumerable.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library ICollectionTAddAdds an item to the ICollectionT. This implementation always throws NotSupportedException.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library ICollectionTClearRemoves all items from the ICollectionT. This implementation always throws NotSupportedException.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library ICollectionCopyToCopies the elements of the ICollection to an Array, starting at a particular Array index.
Explicit interface implemetation Private property Supported by the XNA Framework Supported by Portable Class Library ICollectionTIsReadOnlyGets a value indicating whether the ICollectionT is read-only.
Explicit interface implemetation Private property Supported by the XNA Framework Supported by Portable Class Library ICollectionIsSynchronizedGets a value indicating whether access to the ICollection is synchronized (thread safe).
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library ICollectionTRemoveRemoves the first occurrence of a specific object from the ICollectionT. This implementation always throws NotSupportedException.
Explicit interface implemetation Private property Supported by the XNA Framework Supported by Portable Class Library ICollectionSyncRootGets an object that can be used to synchronize access to the ICollection.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IEnumerableGetEnumeratorReturns an enumerator that iterates through a collection.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListAddAdds an item to the IList. This implementation always throws NotSupportedException.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListClearRemoves all items from the IList. This implementation always throws NotSupportedException.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListContainsDetermines whether the IList contains a specific value.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListIndexOfDetermines the index of a specific item in the IList.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListTInsertInserts an item to the IListT at the specified index. This implementation always throws NotSupportedException.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListInsertInserts an item to the IList at the specified index. This implementation always throws NotSupportedException.
Explicit interface implemetation Private property Supported by the XNA Framework Supported by Portable Class Library IListIsFixedSizeGets a value indicating whether the IList has a fixed size.
Explicit interface implemetation Private property Supported by the XNA Framework Supported by Portable Class Library IListIsReadOnlyGets a value indicating whether the IList is read-only.
Explicit interface implemetation Private property Supported by the XNA Framework Supported by Portable Class Library IListTItemGets the element at the specified index. An NotSupportedException occurs if you try to set the item at the specified index.
Explicit interface implemetation Private property Supported by the XNA Framework Supported by Portable Class Library IListItemGets the element at the specified index. A NotSupportedException occurs if you try to set the item at the specified index.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListRemoveRemoves the first occurrence of a specific object from the IList. This implementation always throws NotSupportedException.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListTRemoveAtRemoves the IListT item at the specified index. This implementation always throws NotSupportedException.
Explicit interface implemetation Private method Supported by the XNA Framework Supported by Portable Class Library IListRemoveAtRemoves the IList item at the specified index. This implementation always throws NotSupportedException.
Top
Remarks

An instance of the ReadOnlyCollectionT generic class is always read-only. A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes. See CollectionT for a modifiable version of this class.

Notes to Implementers

This base class is provided to make it easier for implementers to create a generic read-only custom collection. Implementers are encouraged to extend this base class instead of creating their own.

Examples

The following code example demonstrates several members of the ReadOnlyCollectionT class. The code example creates a ListT of strings and adds four dinosaur names to it. The code example then wraps the list in a ReadOnlyCollectionT.

After demonstrating the Count, Contains, Item, and IListIndexOf members, the code example shows that the ReadOnlyCollectionT is just a wrapper for the original ListT by adding a new item to the ListT and displaying the contents of the ReadOnlyCollectionT.

Finally, the code example creates an array larger than the collection and uses the CopyTo method to insert the elements of the collection into the middle of the array.

Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel

Public Class Example

    Public Shared Sub Main()

        Dim dinosaurs As New List(Of String)

        dinosaurs.Add("Tyrannosaurus")
        dinosaurs.Add("Amargasaurus")
        dinosaurs.Add("Deinonychus")
        dinosaurs.Add("Compsognathus")

        Dim readOnlyDinosaurs As _
            New ReadOnlyCollection(Of String)(dinosaurs)

        Console.WriteLine()
        For Each dinosaur As String In readOnlyDinosaurs
            Console.WriteLine(dinosaur)
        Next

        Console.WriteLine(vbLf & "Count: {0}", _
            readOnlyDinosaurs.Count)

        Console.WriteLine(vbLf & "Contains(""Deinonychus""): {0}", _
            readOnlyDinosaurs.Contains("Deinonychus"))

        Console.WriteLine(vbLf & _
            "readOnlyDinosaurs(3): {0}", readOnlyDinosaurs(3))

        Console.WriteLine(vbLf & "IndexOf(""Compsognathus""): {0}", _
            readOnlyDinosaurs.IndexOf("Compsognathus"))

        Console.WriteLine(vbLf & "Insert into the wrapped List:")
        Console.WriteLine("Insert(2, ""Oviraptor"")")
        dinosaurs.Insert(2, "Oviraptor")

        Console.WriteLine()
        For Each dinosaur As String In readOnlyDinosaurs
            Console.WriteLine(dinosaur)
        Next 

        Dim dinoArray(readOnlyDinosaurs.Count + 1) As String
        readOnlyDinosaurs.CopyTo(dinoArray, 1)

        Console.WriteLine(vbLf & "Copied array has {0} elements:", _
            dinoArray.Length)
        For Each dinosaur As String In dinoArray
            Console.WriteLine("""{0}""", dinosaur)
        Next 

   End Sub 
End Class 

' This code example produces the following output: 
' 
'Tyrannosaurus 
'Amargasaurus 
'Deinonychus 
'Compsognathus 
' 
'Count: 4 
' 
'Contains("Deinonychus"): True 
' 
'readOnlyDinosaurs(3): Compsognathus 
' 
'IndexOf("Compsognathus"): 3 
' 
'Insert into the wrapped List: 
'Insert(2, "Oviraptor") 
' 
'Tyrannosaurus 
'Amargasaurus 
'Oviraptor 
'Deinonychus 
'Compsognathus 
' 
'Copied array has 7 elements: 
'"" 
'"Tyrannosaurus" 
'"Amargasaurus" 
'"Oviraptor" 
'"Deinonychus" 
'"Compsognathus" 
'""
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

public class Example
{
    public static void Main()
    {
        List<string> dinosaurs = new List<string>();

        dinosaurs.Add("Tyrannosaurus");
        dinosaurs.Add("Amargasaurus");
        dinosaurs.Add("Deinonychus");
        dinosaurs.Add("Compsognathus");

        ReadOnlyCollection<string> readOnlyDinosaurs = 
            new ReadOnlyCollection<string>(dinosaurs);

        Console.WriteLine();
        foreach( string dinosaur in readOnlyDinosaurs )
        {
            Console.WriteLine(dinosaur);
        }

        Console.WriteLine("\nCount: {0}", readOnlyDinosaurs.Count);

        Console.WriteLine("\nContains(\"Deinonychus\"): {0}", 
            readOnlyDinosaurs.Contains("Deinonychus"));

        Console.WriteLine("\nreadOnlyDinosaurs[3]: {0}", 
            readOnlyDinosaurs[3]);

        Console.WriteLine("\nIndexOf(\"Compsognathus\"): {0}", 
            readOnlyDinosaurs.IndexOf("Compsognathus"));

        Console.WriteLine("\nInsert into the wrapped List:");
        Console.WriteLine("Insert(2, \"Oviraptor\")");
        dinosaurs.Insert(2, "Oviraptor");

        Console.WriteLine();
        foreach( string dinosaur in readOnlyDinosaurs )
        {
            Console.WriteLine(dinosaur);
        }

        string[] dinoArray = new string[readOnlyDinosaurs.Count + 2];
        readOnlyDinosaurs.CopyTo(dinoArray, 1);

        Console.WriteLine("\nCopied array has {0} elements:", 
            dinoArray.Length);
        foreach( string dinosaur in dinoArray )
        {
            Console.WriteLine("\"{0}\"", dinosaur);
        }
    }
}

/* This code example produces the following output:

Tyrannosaurus
Amargasaurus
Deinonychus
Compsognathus

Count: 4

Contains("Deinonychus"): True

readOnlyDinosaurs[3]: Compsognathus

IndexOf("Compsognathus"): 3

Insert into the wrapped List:
Insert(2, "Oviraptor")

Tyrannosaurus
Amargasaurus
Oviraptor
Deinonychus
Compsognathus

Copied array has 7 elements:
""
"Tyrannosaurus"
"Amargasaurus"
"Oviraptor"
"Deinonychus"
"Compsognathus"
""
 */
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Collections::ObjectModel;

void main()
{
    List<String^>^ dinosaurs = gcnew List<String^>();

    dinosaurs->Add("Tyrannosaurus");
    dinosaurs->Add("Amargasaurus");
    dinosaurs->Add("Deinonychus");
    dinosaurs->Add("Compsognathus");

    ReadOnlyCollection<String^>^ readOnlyDinosaurs = 
        gcnew ReadOnlyCollection<String^>(dinosaurs);

    Console::WriteLine();
    for each(String^ dinosaur in readOnlyDinosaurs )
    {
        Console::WriteLine(dinosaur);
    }

    Console::WriteLine("\nCount: {0}", readOnlyDinosaurs->Count);

    Console::WriteLine("\nContains(\"Deinonychus\"): {0}", 
        readOnlyDinosaurs->Contains("Deinonychus"));

    Console::WriteLine("\nreadOnlyDinosaurs[3]: {0}", 
        readOnlyDinosaurs[3]);

    Console::WriteLine("\nIndexOf(\"Compsognathus\"): {0}", 
        readOnlyDinosaurs->IndexOf("Compsognathus"));

    Console::WriteLine("\nInsert into the wrapped List:");
    Console::WriteLine("Insert(2, \"Oviraptor\")");
    dinosaurs->Insert(2, "Oviraptor");

    Console::WriteLine();
    for each( String^ dinosaur in readOnlyDinosaurs )
    {
        Console::WriteLine(dinosaur);
    }

    array<String^>^ dinoArray = 
        gcnew array<String^>(readOnlyDinosaurs->Count + 2);
    readOnlyDinosaurs->CopyTo(dinoArray, 1);

    Console::WriteLine("\nCopied array has {0} elements:", 
        dinoArray->Length);
    for each( String^ dinosaur in dinoArray )
    {
        Console::WriteLine("\"{0}\"", dinosaur);
    }
}

/* This code example produces the following output:

Tyrannosaurus
Amargasaurus
Deinonychus
Compsognathus

Count: 4

Contains("Deinonychus"): True

readOnlyDinosaurs[3]: Compsognathus

IndexOf("Compsognathus"): 3

Insert into the wrapped List:
Insert(2, "Oviraptor")

Tyrannosaurus
Amargasaurus
Oviraptor
Deinonychus
Compsognathus

Copied array has 7 elements:
""
"Tyrannosaurus"
"Amargasaurus"
"Oviraptor"
"Deinonychus"
"Compsognathus"
""
 */
Version Information

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Thread Safety

Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

A ReadOnlyCollectionT can support multiple readers concurrently, as long as the collection is not modified. Even so, enumerating through a collection is intrinsically not a thread-safe procedure. To guarantee thread safety during enumeration, you can lock the collection during the entire enumeration. To allow the collection to be accessed by multiple threads for reading and writing, you must implement your own synchronization.