AdapterHelper.FindIndexByName Method
- Namespace
- Kampute.DocToolkit.Metadata.Adapters
- Assembly
- Kampute.DocToolkit.dll
Definition
Finds the index of a member by name using binary search.
public static int FindIndexByName<T>(this IReadOnlyList<T> members, string name)
where T : IMemberType Parameters
T- The type of members in the list.
Parameters
membersIReadOnlyList<T>- The list of members, ordered by IMember.Name.
namestring- The name to search for.
Returns
- int
- The index of the member with the specified name, or -1 if not found.
Exceptions
- ArgumentNullException
- Thrown when
membersornameisnull.
Remarks
This method uses binary search to efficiently locate a member in a sorted collection. The input collection must be ordered by member name using ordinal string comparison; otherwise, results are undefined.
