ArrayList.IndexOf Method (Object, Int32, Int32)
Searches for a specified object within that portion of the ArrayList collection that starts at a specified index number and contains a specified number of objects. Returns the zero-based index number of the first occurrence of that object (if any) within the specified portion of the collection.
Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Syntax
public virtual int IndexOf (
Objectvalue,
intstartIndex,
intcount
)
Parameters
- value
The object you want to locate in the ArrayList collection. This value can be a null reference. - startIndex
The zero-based index number where you want the search to start . - count
The number of objects in the portion of the collection you want to search.
Return Value
The zero-based index number of the first occurrence of a specified value parameter (if any) within that portion of the ArrayList collection that starts at the startIndex number and contains the number of objects specified in the count parameter. If there are no such occurrences, this method returns -1.
Remarks
The ArrayList collection is searched forward, starting at the startIndex number and ending at startIndex + count - 1.
This method performs a linear search; therefore, the average execution time is proportional to the value of the Count property. In other words, this method is an O(n) operation, where n is the value of Count.
This method determines equality by calling the Object.Equals method.
Version Information
Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.
See Also
Reference
ArrayList Class
ArrayList Members
System.Collections Namespace