private IEnumerable <KeyValuePair <int, IXmlElement> > Descendants(IXmlElement element)
        {
            yield return(new KeyValuePair <int, IXmlElement>(
                             element.As <XmlNodeSyntax>().Start,
                             element));

            foreach (var child in element.Elements)
            {
                foreach (var descendant in Descendants(child))
                {
                    yield return(descendant);
                }
            }
        }
        private int GetContainingElementMin(int position, IXmlElement element)
        {
            var node = element.As <XmlNodeSyntax>();

            if (position == node.Start)
            {
                return(RangeHelper.FirstEqualSecond);
            }
            else if (position < node.Start)
            {
                return(RangeHelper.FirstLessThanSecond);
            }
            else if (position > (node.Start + node.FullWidth))
            {
                return(RangeHelper.FirstGreaterThanSecond);
            }
            else
            {
                return(RangeHelper.FirstGreaterThanSecond);
            }
        }
 public static SyntaxNode ValueNode(this IXmlElement element)
 {
     return(element.As <XmlElementSyntax>()?.Content);
 }