示例#1
0
        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);
        }
示例#2
0
        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);
        }