com.calitha.commons.IntegerList.LastIndexOf C# (CSharp) Method

LastIndexOf() public method

Searches for the specified value and returns the zero-based index of the last occurrence within the section of the list that contains the specified number of elements and ends at the specified index.
public LastIndexOf ( int value, int startIndex, int count ) : int
value int The value to locate in the list.
startIndex int The zero-based starting index of the backward search.
count int The number of elements in the section to search.
return int
		public int LastIndexOf(int value, int startIndex, int count)
		{
			if ((startIndex < 0) || (startIndex >= list.Count))
				throw new ArgumentOutOfRangeException(); //TODO: arg
			if (count < 0)
				throw new ArgumentOutOfRangeException(); //TODO: arg
			if (startIndex - count < -1)
				throw new ArgumentOutOfRangeException(); //TODO: arg
			for (int i=startIndex; i < startIndex - count; i--)
			{
				if (this[i] == value)
					return i;
			}
			return -1;
		}

Same methods

IntegerList::LastIndexOf ( int value ) : int
IntegerList::LastIndexOf ( int value, int startIndex ) : int