Table of Contents

FindSingleInstance Method

Definition

FindSingleInstance<T>(IDecorator<IHierarchy<T>>, Func<IHierarchy<T>, bool>)

Returns the only node that match the conditions defined by the function delegate match, or a default value if no node instance is found; this method throws an exception if more than one node is found.

public static T FindSingleInstance<T>(this IDecorator<IHierarchy<T>> decorator, Func<IHierarchy<T>, bool> match)

Parameters

decorator IDecorator<IHierarchy<T>>

The decorator that wraps the IHierarchy<T> to extend.

match Func<IHierarchy<T>, bool>

The function delegate that defines the conditions of the nodes to search for.

Returns

T

An Instance node that match the conditions defined by the function delegate match, or a default value if no node instance is found.

Type Parameters

T

The type of the instance that this node represents.