public static Node <TNodeType> GetNode <TNodeType>(this IContainerNode <TNodeType> containerNode, TNodeType nodeType, IEqualityComparer <TNodeType> nodeTypeEqualityComparer) { Contract.Requires(containerNode != null); var node = containerNode.Nodes() .SingleOrDefault(x => nodeTypeEqualityComparer.Equals(x.NodeType, nodeType)); return(node); }
public static bool ContainsNode <TNodeType>(this IContainerNode <TNodeType> containerNode, TNodeType nodeType, IEqualityComparer <TNodeType> nodeTypeEqualityComparer) { Contract.Requires(containerNode != null); Contract.Requires(nodeTypeEqualityComparer != null); var containsNode = containerNode.Nodes() .Any(x => nodeTypeEqualityComparer.Equals(x.NodeType, nodeType)); return(containsNode); }