list class : LastIndexOfByRef(class,int) method

Description

It returns an index of the last child that matches as a reference.

Syntax

listInstance.LastIndexOfByRef(class search, int startPosition)

Arguments

ClassNameDescription
classsearchInstance to search.
intstartPositionStart position of the searching.

Return value

ClassDescription
intIndex.

Sample code

1:

list{string} stringList = new list{string}();

2:

string searchString = "a";

3:

stringList.Add(searchString);

4:

stringList.Add("b");

5:

stringList.Add(searchString);

6:

int index = stringList.LastIndexOfByRef(searchString, 1); // The result (index) is 0.

Notes

This method searches from the specified position toward the top of the list.

Returns 0 or more if the first argument exists in the list, otherwise returns -1.

This method compare equivalence as references. Please note that do not compare equivalence as value.

UnknownException (ArgumentOutOfOfRangeException) is thrown if the second argument is less than zero or greater than or equal to the number of elements in the list.

Links for reference

None

Copyright © Rice All rights reserved.