12 [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))]
13 [DebuggerDisplay(
"Count = {Count}")]
14 [__DynamicallyInvokable]
20 private object _syncRoot;
24 [__DynamicallyInvokable]
27 [__DynamicallyInvokable]
40 [__DynamicallyInvokable]
41 public T this[
int index]
43 [__DynamicallyInvokable]
52 [__DynamicallyInvokable]
55 [__DynamicallyInvokable]
65 [__DynamicallyInvokable]
68 [__DynamicallyInvokable]
79 [__DynamicallyInvokable]
82 [__DynamicallyInvokable]
87 [__DynamicallyInvokable]
90 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
97 [__DynamicallyInvokable]
100 [__DynamicallyInvokable]
109 [__DynamicallyInvokable]
112 [__DynamicallyInvokable]
115 if (_syncRoot ==
null)
118 if (collection !=
null)
120 _syncRoot = collection.SyncRoot;
134 [__DynamicallyInvokable]
135 bool IList.IsFixedSize
137 [__DynamicallyInvokable]
147 [__DynamicallyInvokable]
150 [__DynamicallyInvokable]
163 [__DynamicallyInvokable]
164 object IList.this[
int index]
166 [__DynamicallyInvokable]
171 [__DynamicallyInvokable]
174 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
182 [__DynamicallyInvokable]
187 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.list);
196 [__DynamicallyInvokable]
199 return list.Contains(value);
210 [__DynamicallyInvokable]
213 list.CopyTo(array, index);
218 [__DynamicallyInvokable]
221 return list.GetEnumerator();
227 [__DynamicallyInvokable]
230 return list.IndexOf(value);
236 [__DynamicallyInvokable]
239 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
244 [__DynamicallyInvokable]
247 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
254 [__DynamicallyInvokable]
257 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
265 [__DynamicallyInvokable]
268 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
275 [__DynamicallyInvokable]
278 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
283 [__DynamicallyInvokable]
299 [__DynamicallyInvokable]
304 ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
308 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RankMultiDimNotSupported);
310 if (array.GetLowerBound(0) != 0)
312 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_NonZeroLowerBound);
316 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.arrayIndex, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
318 if (array.Length - index <
Count)
320 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
322 T[] array2 = array as
T[];
325 list.CopyTo(array2, index);
328 Type elementType = array.GetType().GetElementType();
329 Type typeFromHandle = typeof(T);
330 if (!elementType.IsAssignableFrom(typeFromHandle) && !typeFromHandle.IsAssignableFrom(elementType))
332 ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
334 object[] array3 = array as
object[];
337 ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
339 int count = list.Count;
342 for (
int i = 0; i < count; i++)
344 array3[index++] = list[i];
347 catch (ArrayTypeMismatchException)
349 ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidArrayType);
357 [__DynamicallyInvokable]
360 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
366 [__DynamicallyInvokable]
369 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
372 private static bool IsCompatibleObject(
object value)
378 return default(T) ==
null;
391 [__DynamicallyInvokable]
394 if (IsCompatibleObject(value))
406 [__DynamicallyInvokable]
409 if (IsCompatibleObject(value))
420 [__DynamicallyInvokable]
423 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
429 [__DynamicallyInvokable]
432 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
438 [__DynamicallyInvokable]
441 ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
int IndexOf(T value)
Searches for the specified object and returns the zero-based index of the first occurrence within the...
Provides the base class for a generic read-only collection.
Represents a non-generic collection of objects that can be individually accessed by index.
new IEnumerator< T > GetEnumerator()
Returns an enumerator that iterates through the collection.
bool Remove(T item)
Removes the first occurrence of a specific object from the T:System.Collections.Generic....
int Count
Gets the number of elements contained in the T:System.Collections.ObjectModel.ReadOnlyCollection`1 in...
Exposes the enumerator, which supports a simple iteration over a collection of a specified type....
void RemoveAt(int index)
Removes the T:System.Collections.Generic.IList`1 item at the specified index.
Represents a strongly-typed, read-only collection of elements.
Represents a read-only collection of elements that can be accessed by index.
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the T:System.Collections.Generic.ICollection`1 to an T:System....
void Insert(int index, T item)
Inserts an item to the T:System.Collections.Generic.IList`1 at the specified index.
Defines methods to manipulate generic collections.
Exposes an enumerator, which supports a simple iteration over a non-generic collection....
bool Contains(T item)
Determines whether the T:System.Collections.Generic.ICollection`1 contains a specific value.
static int CompareExchange(ref int location1, int value, int comparand)
Compares two 32-bit signed integers for equality and, if they are equal, replaces the first value.
bool IsReadOnly
Gets a value indicating whether the T:System.Collections.Generic.ICollection`1 is read-only.
IList< T > Items
Returns the T:System.Collections.Generic.IList`1 that the T:System.Collections.ObjectModel....
int IndexOf(T item)
Determines the index of a specific item in the T:System.Collections.Generic.IList`1.
Represents a collection of objects that can be individually accessed by index.
ReadOnlyCollection(IList< T > list)
Initializes a new instance of the T:System.Collections.ObjectModel.ReadOnlyCollection`1 class that is...
IEnumerator< T > GetEnumerator()
Returns an enumerator that iterates through the T:System.Collections.ObjectModel.ReadOnlyCollection`1...
bool Contains(T value)
Determines whether an element is in the T:System.Collections.ObjectModel.ReadOnlyCollection`1.
void CopyTo(T[] array, int index)
Copies the entire T:System.Collections.ObjectModel.ReadOnlyCollection`1 to a compatible one-dimension...
Specifies that the class can be serialized.
Defines size, enumerators, and synchronization methods for all nongeneric collections.
Provides atomic operations for variables that are shared by multiple threads.
void Add(T item)
Adds an item to the T:System.Collections.Generic.ICollection`1.
void Clear()
Removes all items from the T:System.Collections.Generic.ICollection`1.