AdapterHelper.WhereName Method

Namespace
Kampute.DocToolkit.Metadata.Adapters
Assembly
  • Kampute.DocToolkit.dll

Definition

Filters members by name using binary search.
public static IEnumerable<T> WhereName<T>(this IReadOnlyList<T> members, string name, bool preserveOrder = false)
	where T : IMember

Type Parameters

T
The type of members in the list.

Parameters

members IReadOnlyList<T>
The members to filter, ordered by IMember.Name.
name string
The name to match.
preserveOrder bool optional
If set to true, preserves the original order of members in the output.

Returns

IEnumerable<T>
All members with the specified name.

Exceptions

ArgumentNullException
Thrown when members or name is null.

Remarks

This method uses binary search to efficiently locate members in sorted collections. The input collection must be ordered by member name using ordinal string comparison; otherwise, results are undefined.

This method is implemented by using deferred execution. The immediate return value is an object that stores all the information required to perform the action.