System.Xml.XPath.XPathNavigator.InsertBefore C# (CSharp) Method

InsertBefore() public method

public InsertBefore ( XPathNavigator newSibling ) : void
newSibling XPathNavigator
return void
        public virtual void InsertBefore(XPathNavigator newSibling)
        {
            if (newSibling == null)
            {
                throw new ArgumentNullException(nameof(newSibling));
            }
            if (!IsValidSiblingType(newSibling.NodeType))
            {
                throw new InvalidOperationException(SR.Xpn_BadPosition);
            }
            XmlReader reader = newSibling.CreateReader();
            InsertBefore(reader);
        }

Same methods

XPathNavigator::InsertBefore ( ) : XmlWriter
XPathNavigator::InsertBefore ( XmlReader newSibling ) : void
XPathNavigator::InsertBefore ( string newSibling ) : void

Usage Example

Example #1
0
        public virtual XmlWriter PrependChild()
        {
            XPathNavigator nav = Clone();

            if (nav.MoveToFirstChild())
            {
                return(nav.InsertBefore());
            }
            else
            {
                return(AppendChild());
            }
        }
All Usage Examples Of System.Xml.XPath.XPathNavigator::InsertBefore