Microsoft.Web.Administration.ConfigurationElement.GetElementByPath C# (CSharp) Method

GetElementByPath() private method

private GetElementByPath ( string path ) : ConfigurationElement
path string
return ConfigurationElement
        internal virtual ConfigurationElement GetElementByPath(string path)
        {
            var index = path.IndexOf(Schema.Path, StringComparison.Ordinal);
            if (index != 0)
            {
                return null;
            }

            if (this.Schema.Path.Length != 0)
            {
                if (path.Length != this.Schema.Path.Length && path[this.Schema.Path.Length] != '/')
                {
                    return null;
                }
            }

            if (Schema.Path == path)
            {
                return this;
            }

            foreach (ConfigurationElement child in ChildElements)
            {
                var result = child.GetElementByPath(path);
                if (result != null)
                {
                    return result;
                }
            }

            return null;
        }