예제 #1
0
        /// <summary>
        /// Gets the child node by its path.
        /// </summary>
        /// <param name="path">Path to the node to get.</param>
        /// <param name="throwIfNone">Indicates whether an exception
        /// must be thrown if there is no node with the specified path, or not.</param>
        /// <returns>
        /// Path node, if found;
        /// otherwise, <see langword="null"/>.
        /// </returns>
        public static IPathNode Resolve(this IPathNode node, string path, bool throwIfNone)
        {
            var result = node.Resolve(path);

            if (result == null && throwIfNone)
            {
                throw new InvalidOperationException(string.Format(Strings.ExPathXNotFound, path));
            }
            return(result);
        }