BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 This class is safe for multiple readers and no concurrent writers. System.Object System.Collections.IList System.ICloneable System.Diagnostics.DebuggerDisplay("Count={Count}") System.Diagnostics.DebuggerTypeProxy(typeof(System.Collections.CollectionDebuggerView)) System.Runtime.InteropServices.ComVisible(true)

The following example shows how to create, initialize, and display the values of a .

`using System; using System.Collections; public class SamplesArrayList { public static void Main() { // Create and initialize a new ArrayList. ArrayList myAL = new ArrayList(); myAL.Add("Hello"); myAL.Add("World"); myAL.Add("!"); // Display the properties and values of the ArrayList. Console.WriteLine( "myAL" ); Console.WriteLine( "Count: {0}", myAL.Count ); Console.WriteLine( "Capacity: {0}", myAL.Capacity ); Console.Write( "Values:" ); PrintValues( myAL ); } public static void PrintValues( IEnumerable myList ) { IEnumerator myEnumerator = myList.GetEnumerator(); while ( myEnumerator.MoveNext() ) Console.Write( " {0}", myEnumerator.Current ); Console.WriteLine(); } }`

The output is

myAL

Count: 3

Capacity: 16

Values: Hello World !

For a strongly-typed alternative to , consider using . may not always offer the best performance for a given task. See the "Performance Considerations" section in the reference topic for a discussion of the relative performance of these classes.

The is not guaranteed to be sorted. You must sort the prior to performing operations (such as ) that require the to be sorted.

The capacity of an is the number of elements the can hold. As elements are added to an , the capacity is automatically increased as required through reallocation. The capacity can be decreased by calling or by setting the property explicitly.

For very large objects, you can increase the maximum capacity to 2 billion elements on a 64-bit system by setting the enabled attribute of the gcAllowVeryLargeObjects configuration element to true in the run-time environment.

Elements in this collection can be accessed using an integer index. Indexes in this collection are zero-based.

The collection accepts null as a valid value, allows duplicate elements.

Using multidimensional arrays as elements in an collection is not supported.

Implements the interface using an array whose size is dynamically increased as required.

- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0

  The capacity of an is the number of elements that the can hold. As elements are added to an , the capacity is automatically increased as required by reallocating the internal array.

  If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .

  This constructor is an O(1) operation.

  Initializes a new instance of the class that is empty and has the default initial capacity.

  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  is .

  The capacity of an is the number of elements that the can hold. As elements are added to an , the capacity is automatically increased as required by reallocating the internal array.

  If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .

  The elements are copied onto the in the same order they are read by the of the .

  This constructor is an O() operation, where is the number of elements in .

  Initializes a new instance of the class that contains elements copied from the specified collection and that has the same initial capacity as the number of elements copied.

  The whose elements are copied to the new list.
  0
- Constructor
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  < 0.

  The capacity of an is the number of elements that the can hold. As elements are added to an , the capacity is automatically increased as required by reallocating the internal array.

  If the size of the collection can be estimated, specifying the initial capacity eliminates the need to perform a number of resizing operations while adding elements to the .

  This constructor is an O() operation, where is .

  Initializes a new instance of the class that is empty and has the specified initial capacity.

  The number of elements that the new list can initially store.
  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.ArrayList `` is .

  does not copy the contents of . Instead, it only creates an wrapper around ; therefore, changes to the also affect the .

  The class provides generic , and methods. This wrapper can be a means to use those methods on ; however, performing these generic operations through the wrapper might be less efficient than operations applied directly on the .

  This method is an O(1) operation.

  ## Version Compatibility

  In the .NET Framework version 1.0 and 1.1, calling the method overload on the wrapper returned an enumerator that treated the second argument as an upper bound rather than as a count. In the dnprdnlong the second argument is correctly treated as a count.

  Creates an wrapper for a specific .

  The wrapper around the .

  The to wrap. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  The current instance is read-only or has a fixed size.

  accepts null as a valid value and allows duplicate elements.

  If already equals , the capacity of the is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.

  If is less than , this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O() operation, where is .

  Adds an object to the end of the .

  The index at which the has been added.

  The to be added to the end of the . The value can be null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` is .

  The current instance is read-only or has a fixed size.

  accepts null as a valid value and allows duplicate elements.

  The order of the elements in the is preserved in the .

  If the new (the current plus the size of the collection) will be greater than , the capacity of the is increased by automatically reallocating the internal array to accommodate the new elements, and the existing elements are copied to the new array before the new elements are added.

  If the can accommodate the new elements without increasing the , this method is an O() operation, where is the number of elements to be added. If the capacity needs to be increased to accommodate the new elements, this method becomes an O( + ) operation, where is the number of elements to be added and is .

  Adds the elements of an to the end of the .

  The whose elements should be added to the end of the . The collection itself cannot be null, but it can contain elements that are null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  is not assignment-compatible with at least one element in the current instance.

  Both and at least one element involved in the search of the current instance do not implement the interface.

  The parameter and each element of the must implement the interface, which is used for comparisons. The elements of the must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  Comparing null with any type is allowed and does not generate an exception when using . When sorting, null is considered to be less than any other object.

  If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.

  This method is an O(log ) operation, where is .

  Searches the entire sorted for an element using the default comparer and returns the zero-based index of the element.

  The zero-based index of in the sorted , if is found; otherwise, a negative number, which is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .

  The to locate. The value can be null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` ``

  is , and is not assignment-compatible with at least one element in the current instance.

  is , and both and at least one element involved in the search in the current instance do not implement the interface.

  The comparer customizes how the elements are compared. For example, you can use a instance as the comparer to perform case-insensitive string searches.

  If is provided, the elements of the are compared to the specified value using the specified implementation. The elements of the must already be sorted in increasing value according to the sort order defined by ; otherwise, the result might be incorrect.

  If is null, the comparison is done using the implementation provided by the element itself or by the specified value. The elements of the must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  Comparing null with any type is allowed and does not generate an exception when using . When sorting, null is considered to be less than any other object.

  If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.

  This method is an O(log ) operation, where is .

  Searches the entire sorted for an element using the specified comparer and returns the zero-based index of the element.

  The zero-based index of in the sorted , if is found; otherwise, a negative number, which is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .

  The to locate. The value can be null. The implementation to use when comparing elements. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` `` ``

  of the current instance - < .

  -or-

  is , and is not assignment-compatible with at least one element in the current instance.

  < 0.

  -or-

  < 0.

  is , and both and at least one element involved in the search of the current instance do not implement the interface.

  The comparer customizes how the elements are compared. For example, you can use a instance as the comparer to perform case-insensitive string searches.

  If is provided, the elements of the are compared to the specified value using the specified implementation. The elements of the must already be sorted in increasing value according to the sort order defined by ; otherwise, the result might be incorrect.

  If is null, the comparison is done using the implementation provided by the element itself or by the specified value. The elements of the must already be sorted in increasing value according to the sort order defined by the implementation; otherwise, the result might be incorrect.

  Comparing null with any type is allowed and does not generate an exception when using . When sorting, null is considered to be less than any other object.

  If the contains more than one element with the same value, the method returns only one of the occurrences, and it might return any one of the occurrences, not necessarily the first one.

  If the does not contain the specified value, the method returns a negative integer. You can apply the bitwise complement operation (~) to this negative integer to get the index of the first element that is larger than the search value. When inserting the value into the , this index should be used as the insertion point to maintain the sort order.

  This method is an O(log ) operation, where is .

  Searches a range of elements in the sorted for an element using the specified comparer and returns the zero-based index of the element.

  The zero-based index of in the sorted , if is found; otherwise, a negative number, which is the bitwise complement of the index of the next element that is larger than or, if there is no larger element, the bitwise complement of .

  The zero-based starting index of the range to search. The length of the range to search. The to locate. The value can be null. The implementation to use when comparing elements. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A that specifies the number of elements that the current instance is capable of storing.

  is set to a value that is less than the of the current instance.

  is the number of elements that the can store. is the number of elements that are actually in the .

  is always greater than or equal to . If exceeds while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

  The capacity can be decreased by calling or by setting the property explicitly. When the value of is set explicitly, the internal array is also reallocated to accommodate the specified capacity.

  Retrieving the value of this property is an O(1) operation; setting the property is an O() operation, where is the new capacity.

  Gets or sets the number of elements that the can contain.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The current instance is read-only or has a fixed size.

  is set to zero, and references to other objects from elements of the collection are also released.

  remains unchanged. To reset the capacity of the , call or set the property directly. Trimming an empty sets the capacity of the to the default capacity.

  This method is an O() operation, where is .

  Removes all elements from the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object

  A shallow copy of a collection copies only the elements of the collection, whether they are reference types or value types, but it does not copy the objects that the references refer to. The references in the new collection point to the same objects that the references in the original collection point to.

  In contrast, a deep copy of a collection copies the elements and everything directly or indirectly referenced by the elements.

  This method is an O() operation, where is .

  Creates a shallow copy of the .

  A shallow copy of the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean ``

  This method performs a linear search; therefore, this method is an O() operation, where is .

  This method determines equality by calling .

  Starting with the .NET Framework 2.0, this method uses the collection’s objects’ and methods on to determine whether item exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the parameter on the objects in the collection.

  Determines whether an element is in the .

  true if is found in the ; otherwise, false.

  The to locate in the . The value can be null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` is .

  has more than one dimension.

  -or-

  of the current instance > .Length.

  At least one element in the current instance is not assignment-compatible with the type of .

  The specified array must be of a compatible type.

  This method uses to copy the elements.

  The elements are copied to the in the same order in which the enumerator iterates through the .

  This method is an O() operation, where is .

  Copies the entire to a compatible one-dimensional , starting at the beginning of the target array.

  The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` is . < 0.

  has more than one dimension.

  -or-

  >= .Length.

  -or-

  + of the current instance > .Length.

  At least one element in the current instance is not assignment-compatible with the type of .

  The specified array must be of a compatible type.

  This method uses to copy the elements.

  The elements are copied to the in the same order in which the enumerator iterates through the .

  This method is an O() operation, where is .

  Copies the entire to a compatible one-dimensional , starting at the specified index of the target array.

  The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. The zero-based index in at which copying begins. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` `` `` is .

  < 0.

  -or-

  < 0.

  -or-

  < 0.

  has more than one dimension.

  -or-

  >= of the current instance .

  -or-

  >= of the current instance - .

  -or-

  >= .Length - .

  At least one element of the current instance is not assignment-compatible with the type of .

  The specified array must be of a compatible type.

  This method uses to copy the elements.

  The elements are copied to the in the same order in which the enumerator iterates through the .

  This method is an O() operation, where is .

  Copies a range of elements from the to a compatible one-dimensional , starting at the specified index of the target array.

  The zero-based index in the source at which copying begins. The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. The zero-based index in at which copying begins. The number of elements to copy. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32

  A that specifies the number of elements contained in the current instance.

  is the number of elements that the can store. is the number of elements that are actually in the .

  is always greater than or equal to . If exceeds while adding elements, the capacity is automatically increased by reallocating the internal array before copying the old elements and adding the new elements.

  Retrieving the value of this property is an O(1) operation.

  Gets the number of elements actually contained in the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.ArrayList `` is .

  This wrapper can be used to prevent additions to and deletions from the original . The elements can still be modified or replaced.

  A collection with a fixed size is simply a collection with a wrapper that prevents adding and removing elements; therefore, if changes are made to the underlying collection, including the addition or removal of elements, the fixed-size collection reflects those changes.

  This method is an O(1) operation.

  Returns an wrapper with a fixed size.

  An wrapper with a fixed size.

  The to wrap. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.IList ``

  This wrapper can be used to prevent additions to and deletions from the original . The elements can still be modified or replaced.

  A collection with a fixed size is simply a collection with a wrapper that prevents adding and removing elements; therefore, if changes are made to the underlying collection, including the addition or removal of elements, the fixed-size collection reflects those changes.

  This method is an O(1) operation.

  Returns an wrapper with a fixed size.

  An wrapper with a fixed size.

  The to wrap.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.IEnumerator

  The foreach statement of the C# language (for each in Visual Basic) hides the complexity of the enumerators. Therefore, using foreach is recommended, instead of directly manipulating the enumerator.

  Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.

  Initially, the enumerator is positioned before the first element in the collection. also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .

  returns the same object until either or is called. sets to the next element.

  If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns false. When the enumerator is at this position, subsequent calls to also return false. If the last call to returned false, is undefined. To set to the first element of the collection again, you can call followed by .

  An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and its behavior is undefined.

  The enumerator does not have exclusive access to the collection; therefore, 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.

  This method is an O(1) operation.

  Returns an enumerator for the entire .

  An for the entire .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.IEnumerator `` ``

  < 0.

  -or-

  < 0.

  + > of the current instance.

  The foreach statement of the C# language (for each in Visual C++, For Each Visual Basic) hides the complexity of the enumerators. Therefore, using foreach is recommended, instead of directly manipulating the enumerator.

  Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.

  Initially, the enumerator is positioned before the first element in the collection. also brings the enumerator back to this position. At this position, is undefined. Therefore, you must call to advance the enumerator to the first element of the collection before reading the value of .

  returns the same object until either or is called. sets to the next element.

  If passes the end of the collection, the enumerator is positioned after the last element in the collection and returns false. When the enumerator is at this position, subsequent calls to also return false. If the last call to returned false, is undefined. To set to the first element of the collection again, you can call followed by .

  An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and its behavior is undefined.

  The enumerator does not have exclusive access to the collection; therefore, 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.

  This method is an O(1) operation.

  ## Version Compatibility

  In the .NET Framework versions 1.0 and 1.1, the enumerator for an wrapper returned by the method treated the second argument as an upper bound rather than as a count. In the dnprdnlong the second argument is correctly treated as a count.

  Returns an enumerator for a range of elements in the .

  An for the specified range of elements in the .

  The zero-based starting index of the section that the enumerator should refer to. The number of elements in the section that the enumerator should refer to. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.ArrayList `` ``

  < 0.

  -or-

  < 0.

  of the current instance - < .

  This method does not create copies of the elements. The new is only a view window into the source . However, all subsequent changes to the source must be done through this view window . If changes are made directly to the source , the view window is invalidated and any operations on it will return an .

  This method is an O(1) operation.

  Returns an which represents a subset of the elements in the source .

  An which represents a subset of the elements in the source .

  The zero-based index at which the range starts. The number of elements in the range. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  The is searched forward starting at the first element and ending at the last element.

  This method performs a linear search; therefore, this method is an O() operation, where is .

  This method determines equality by calling .

  Starting with the .NET Framework 2.0, this method uses the collection’s objects’ and methods on to determine whether item exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the parameter on the objects in the collection.

  Searches for the specified and returns the zero-based index of the first occurrence within the entire .

  The zero-based index of the first occurrence of within the entire , if found; otherwise, -1.

  The to locate in the . The value can be null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` ``

  < 0.

  -or-

  >= of the current instance.

  The is searched forward starting at and ending at the last element.

  This method performs a linear search; therefore, this method is an O() operation, where is the number of elements from to the end of the .

  This method determines equality by calling .

  Starting with the .NET Framework 2.0, this method uses the collection’s objects’ and methods on to determine whether item exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the parameter on the objects in the collection.

  Searches for the specified and returns the zero-based index of the first occurrence within the range of elements in the that extends from the specified index to the last element.

  The zero-based index of the first occurrence of within the range of elements in the that extends from to the last element, if found; otherwise, -1.

  The to locate in the . The value can be null. The zero-based starting index of the search. 0 (zero) is valid in an empty list. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` ``

  >= of the current instance.

  -or-

  < 0.

  -or-

  > of the current instance - .

  The is searched forward starting at and ending at plus minus 1, if is greater than 0.

  This method performs a linear search; therefore, this method is an O() operation, where is .

  This method determines equality by calling .

  Starting with the .NET Framework 2.0, this method uses the collection’s objects’ and methods on to determine whether item exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the parameter on the objects in the collection.

  Searches for the specified and returns the zero-based index of the first occurrence within the range of elements in the that starts at the specified index and contains the specified number of elements.

  The zero-based index of the first occurrence of within the range of elements in the that starts at and contains number of elements, if found; otherwise, -1.

  The to locate in the . The value can be null. The zero-based starting index of the search. 0 (zero) is valid in an empty list. The number of elements in the section to search. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  < 0.

  -or-

  > of the current instance.

  The current instance is read-only or has a fixed size.

  accepts null as a valid value and allows duplicate elements.

  If already equals , the capacity of the is increased by automatically reallocating the internal array, and the existing elements are copied to the new array before the new element is added.

  If is equal to , is added to the end of .

  In collections of contiguous elements, such as lists, the elements that follow the insertion point move down to accommodate the new element. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

  This method is an O() operation, where is .

  Inserts an element into the at the specified index.

  The zero-based index at which should be inserted. The to insert. The value can be null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` is .

  < 0.

  > of the current instance.

  The current instance is read-only or has a fixed size.

  accepts null as a valid value and allows duplicate elements.

  If the new (the current plus the size of the collection) will be greater than , the capacity of the is increased by automatically reallocating the internal array to accommodate the new elements, and the existing elements are copied to the new array before the new elements are added.

  If is equal to , the elements are added to the end of .

  The order of the elements in the is preserved in the .

  In collections of contiguous elements, such as lists, the elements that follow the insertion point move down to accommodate the new element. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

  This method is an O( + ) operation, where is the number of elements to be added and is .

  Inserts the elements of a collection into the at the specified index.

  The zero-based index at which the new elements should be inserted. The whose elements should be inserted into the . The collection itself cannot be null, but it can contain elements that are null. 0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the of the current instance cannot be changed; otherwise, .

  A collection with a fixed size does not allow the addition or removal of elements after the collection is created, but it allows the modification of existing elements.

  A collection with a fixed size is simply a collection with a wrapper that prevents adding and removing elements; therefore, if changes are made to the underlying collection, including the addition or removal of elements, the fixed-size collection reflects those changes.

  Retrieving the value of this property is an O(1) operation.

  Gets a value indicating whether the has a fixed size.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if the current instance is read-only; otherwise, .

  A collection that is read-only does not allow the addition, removal, or modification of elements after the collection is created.

  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.

  Retrieving the value of this property is an O(1) operation.

  Gets a value indicating whether the is read-only.

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Boolean

  if access to the current instance is synchronized (thread-safe); otherwise, .

  To guarantee the thread safety of the , all operations must be done through the wrapper returned by the method.

  Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

  Gets a value indicating whether access to the is synchronized (thread safe).

  0
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object `` A that specifies the zero-based index of the element in the current instance to get or set. This value is greater than or equal to 0, and less than the of the current instance.

  Gets or sets the element at the specified index of the current instance.

  The element at the specified index of the current instance.

  This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[index] .

  This property is implemented to support the interface.

  As described above.

  < 0.

  -or-

  >= of the current instance.

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 ``

  The is searched backward starting at the last element and ending at the first element.

  This method performs a linear search; therefore, this method is an O() operation, where is .

  Starting with the .NET Framework 2.0, this method uses the collection’s objects’ and methods on to determine whether item exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the parameter on the objects in the collection.

  Searches for the specified and returns the zero-based index of the last occurrence within the entire .

  The zero-based index of the last occurrence of within the entire the , if found; otherwise, -1.

  The to locate in the . The value can be null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` ``

  < 0.

  -or-

  >= of the current instance.

  The is searched backward starting at and ending at the first element.

  This method performs a linear search; therefore, this method is an O() operation, where is the number of elements from the beginning of the to .

  This method determines equality by calling .

  Starting with the .NET Framework 2.0, this method uses the collection’s objects’ and methods on to determine whether item exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the parameter on the objects in the collection.

  Searches for the specified and returns the zero-based index of the last occurrence within the range of elements in the that extends from the first element to the specified index.

  The zero-based index of the last occurrence of within the range of elements in the that extends from the first element to , if found; otherwise, -1.

  The to locate in the . The value can be null. The zero-based starting index of the backward search. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Int32 `` `` ``

  < 0.

  -or-

  < 0.

  -or-

  >= of the current instance.

  -or-

  >= of the current instance.

  -or-

  > + 1.

  The is searched backward starting at and ending at minus plus 1, if is greater than 0.

  This method performs a linear search; therefore, this method is an O() operation, where is .

  This method determines equality by calling .

  Starting with the .NET Framework 2.0, this method uses the collection’s objects’ and methods on to determine whether item exists. In the earlier versions of the .NET Framework, this determination was made by using the and methods of the parameter on the objects in the collection.

  Searches for the specified and returns the zero-based index of the last occurrence within the range of elements in the that contains the specified number of elements and ends at the specified index.

  The zero-based index of the last occurrence of within the range of elements in the that contains number of elements and ends at , if found; otherwise, -1.

  The to locate in the . The value can be null. The zero-based starting index of the backward search. The number of elements in the section to search. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.ArrayList `` is .

  To prevent any modifications to , expose only through this wrapper.

  A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection. If changes are made to the underlying collection, the read-only collection reflects those changes.

  This method is an O(1) operation.

  Returns a read-only wrapper.

  A read-only wrapper around .

  The to wrap. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.IList ``

  To prevent any modifications to , expose only through this wrapper.

  A collection that is read-only is simply a collection with a wrapper that prevents modifying the collection. If changes are made to the underlying collection, the read-only collection reflects those changes.

  This method is an O(1) operation.

  Returns a read-only wrapper.

  A read-only wrapper around .

  The to wrap.
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  The current instance is read-only or has a fixed size.

  If the does not contain the specified object, the remains unchanged. No exception is thrown.

  This method performs a linear search; therefore, this method is an O() operation, where is .

  This method determines equality by calling .

  In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

  Removes the first occurrence of a specific object from the .

  The to remove from the . The value can be null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void ``

  < 0.

  -or-

  >= of the current instance.

  The current instance is read-only or has a fixed size.

  After the element is removed, the size of the collection is adjusted and the value of the property is decreased by one.

  In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

  This method is an O() operation, where is .

  Removes the element at the specified index of the .

  The zero-based index of the element to remove. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  < 0.

  -or-

  < 0.

  of the current instance - < .

  The current instance is read-only or has a fixed size.

  In collections of contiguous elements, such as lists, the elements that follow the removed element move up to occupy the vacated spot. If the collection is indexed, the indexes of the elements that are moved are also updated. This behavior does not apply to collections where elements are conceptually grouped into buckets, such as a hash table.

  This method is an O() operation, where is .

  Removes a range of elements from the .

  The zero-based starting index of the range of elements to remove. The number of elements to remove. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.ArrayList `` `` < 0.

  accepts null as a valid value and allows duplicate elements.

  This method is an O() operation, where is .

  Returns an whose elements are copies of the specified value.

  An with number of elements, all of which are copies of .

  The to copy multiple times in the new . The value can be null. The number of times should be copied. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void The current instance is read-only.

  This method uses to reverse the order of the elements, such that the element at [i], where i is any index within the range, moves to [j], where j equals + + - i - 1.

  This method is an O() operation, where is .

  Reverses the order of the elements in the entire .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  < 0.

  -or-

  < 0.

  of the current instance - < .

  The current instance is read-only.

  This method uses to reverse the order of the elements, such that the element at [i], where i is any index within the range, moves to [j], where j equals + + - i - 1.

  This method is an O() operation, where is .

  Reverses the order of the elements in the specified range.

  The zero-based starting index of the range to reverse. The number of elements in the range to reverse. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  < 0.

  -or-

  of the current instance - < .Count.

  is . The current instance is read-only.

  accepts null as a valid value and allows duplicate elements.

  The order of the elements in the is preserved in the .

  This method is an O( + 1) operation, where is .

  Copies the elements of a collection over a range of elements in the .

  The zero-based index at which to start copying the elements of . The whose elements to copy to the . The collection itself cannot be null, but it can contain elements that are null. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void One or more elements in the current instance do not implement the interface. The current instance is read-only.

  This method uses , which uses the QuickSort algorithm. The QuickSort algorithm is a comparison sort (also called an unstable sort), which means that a "less than or equal to" comparison operation determines which of two elements should occur first in the final sorted list. However, if two elements are equal, their original order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal. To perform a stable sort, you must implement a custom interface to use with the other overloads of this method.

  On average, this method is an O( log ) operation, where is ; in the worst case it is an O(^2) operation.

  Sorts the elements in the entire .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` is , and one or more elements in the current instance do not implement the interface. The current instance is read-only. is , and one or more elements in the current instance do not implement the interface.

  Use the method to sort a list of objects with a custom comparer that implements the interface. If you pass null for , this method uses the implementation of each element. In this case, you must make sure that the objects contained in the list implement the interface or an exception will occur.

  In addition, using the implementation means the list performs a comparison sort (also called an unstable sort); that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal. To perform a stable sort, you must implement a custom interface.

  On average, this method is an O( log ) operation, where is ; in the worst case it is an O(^2) operation.

  Sorts the elements in the entire using the specified comparer.

  The implementation to use when comparing elements. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

  < 0.

  -or-

  < 0.

  of the current instance - < .

  is , and one or more elements in the current instance do not implement the interface. The current instance is read-only. is , and one or more elements in the current instance do not implement the interface.

  If is set to null, this method performs a comparison sort (also called an unstable sort); that is, if two elements are equal, their order might not be preserved. In contrast, a stable sort preserves the order of elements that are equal. To perform a stable sort, you must implement a custom interface.

  On average, this method is an O( log ) operation, where is ; in the worst case it is an O(n^2) operation.

  Sorts the elements in a range of elements in using the specified comparer.

  The zero-based starting index of the range to sort. The length of the range to sort. The implementation to use when comparing elements. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.ArrayList `` is .

  To guarantee the thread safety of the , all operations must be done through this wrapper.

  Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

  Returns an wrapper that is synchronized (thread safe).

  An wrapper that is synchronized (thread safe).

  The to synchronize. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Collections.IList ``

  To guarantee the thread safety of the , all operations must be done through this wrapper.

  Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

  Returns an wrapper that is synchronized (thread safe).

  An wrapper that is synchronized (thread safe).

  The to synchronize.
- Property
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object

  A that can be used to synchronize access to the current instance.

  To create a synchronized version of the , use the method. However, derived classes can provide their own synchronized version of the using the property. The synchronizing code must perform operations on the of the , not directly on the . This ensures proper operation of collections that are derived from other objects. Specifically, it maintains proper synchronization with other threads that might be simultaneously modifying the object.

  Enumerating through a collection is intrinsically not a thread-safe procedure. Even when a collection is synchronized, other threads can still modify the collection, which causes the enumerator to throw an exception. To guarantee thread safety during enumeration, you can either lock the collection during the entire enumeration or catch the exceptions resulting from changes made by other threads.

  Gets an object that can be used to synchronize access to the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Object[]

  The elements are copied using , which is an O() operation, where is .

  Copies the elements of the to a new array.

  An array containing copies of the elements of the .

  0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Array `` is . At least one element of the current instance cannot be cast to the .

  All of the objects in the object will be cast to the specified in the parameter.

  The elements are copied using , which is an O() operation, where is .

  Copies the elements of the to a new array of the specified element type.

  An array of the specified element type containing copies of the elements of the .

  The element of the destination array to create and copy elements to. 0
- Method
  1.0.5000.0
  2.0.0.0
  4.0.0.0
  System.Void

  The current instance is read-only or has a fixed size.

  This method can be used to minimize a collection's memory overhead if no new elements will be added to the collection.

  To reset a to its initial state, call the method before calling . Trimming an empty sets the capacity of the to the default capacity.

  This method is an O() operation, where is .

  Sets the capacity to the actual number of elements in the .

  0
0