System.Xml.DocumentXmlWriter.CloseWithReplaceToFollowingSibling C# (CSharp) Method

CloseWithReplaceToFollowingSibling() private method

private CloseWithReplaceToFollowingSibling ( ) : void
return void
        private void CloseWithReplaceToFollowingSibling() {
            XmlNode parent = start.ParentNode;
            if (parent == null) {
                throw new InvalidOperationException(Res.GetString(Res.Xpn_MissingParent));
            }
            if (start != end) {
                if (!DocumentXPathNavigator.IsFollowingSibling(start, end)) {
                    throw new InvalidOperationException(Res.GetString(Res.Xpn_BadPosition));
                }
                if (start.IsReadOnly) {
                    throw new InvalidOperationException(Res.GetString(Res.Xdom_Node_Modify_ReadOnly));
                }
                DocumentXPathNavigator.DeleteToFollowingSibling(start.NextSibling, end);
            }
            XmlNode fragment0 = fragment[0];
            parent.ReplaceChild(fragment0, start);
            for (int i = fragment.Count - 1; i >= 1; i--) {
                parent.InsertAfter(fragment[i], fragment0);
            }
            navigator.ResetPosition(fragment0);
        }