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 : IMember

Type Parameters

T
The type of members in the list.

Parameters

members IReadOnlyList<T>
The list of members, ordered by IMember.Name.
name string
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 members or name is null.

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.