System.Collections.ArrayList.ArrayListAdapter.IndexOf C# (CSharp) Method

IndexOf() public method

public IndexOf ( object value, int startIndex, int count ) : int
value object
startIndex int
count int
return int
			public override int IndexOf(object value, int startIndex, int count) 
			{
				if (startIndex < 0 || startIndex > m_Adaptee.Count) 
				{
					ThrowNewArgumentOutOfRangeException ("startIndex", startIndex,
						"Does not specify valid index.");
				}

				if (count < 0) 
				{
					ThrowNewArgumentOutOfRangeException ("count", count,
						"Can't be less than 0.");
				}

				// re-ordered to avoid possible integer overflow
				if (startIndex > m_Adaptee.Count - count) {
					// LAMESPEC: Every other method throws ArgumentException
					throw new ArgumentOutOfRangeException("count",
						"Start index and count do not specify a valid range.");
				}

				if (value == null) 
				{
					for (int i = startIndex; i < startIndex + count; i++) 
					{
						if (m_Adaptee[i] == null) 
						{
							return i;
						}
					}
				}
				else 
				{
					for (int i = startIndex; i < startIndex + count; i++) 
					{
						if (value.Equals(m_Adaptee[i])) 
						{
							return i;
						}
					}
				}

				return -1;
			}

Same methods

ArrayList.ArrayListAdapter::IndexOf ( object value ) : int
ArrayList.ArrayListAdapter::IndexOf ( object value, int startIndex ) : int