System.Collections.ArrayList.IListWrapper.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 > Count) throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
                if (count < 0 || startIndex > Count - count) throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
                Contract.EndContractBlock();

                int endIndex = startIndex + count;
                if (value == null)
                {
                    for (int i = startIndex; i < endIndex; i++)
                        if (_list[i] == null)
                            return i;
                    return -1;
                }
                else
                {
                    for (int i = startIndex; i < endIndex; i++)
                        if (_list[i] != null && _list[i].Equals(value))
                            return i;
                    return -1;
                }
            }

Same methods

ArrayList.IListWrapper::IndexOf ( Object value ) : int
ArrayList.IListWrapper::IndexOf ( Object value, int startIndex ) : int