當前位置: 首頁>>代碼示例>>C#>>正文


C# XNode.NodesAfterSelf方法代碼示例

本文整理匯總了C#中System.Xml.Linq.XNode.NodesAfterSelf方法的典型用法代碼示例。如果您正苦於以下問題:C# XNode.NodesAfterSelf方法的具體用法?C# XNode.NodesAfterSelf怎麽用?C# XNode.NodesAfterSelf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Xml.Linq.XNode的用法示例。


在下文中一共展示了XNode.NodesAfterSelf方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ExecuteXElementVariation

 public void ExecuteXElementVariation(XNode[] toAdd, XNode contextNode)
 {
     IEnumerable<XNode> allNodes, toAddList = toAdd.OfType<XNode>();
     XElement xElem = contextNode == null ? new XElement("root") : new XElement("root", contextNode);
     XElement xElemOriginal = new XElement(xElem);
     using (UndoManager undo = new UndoManager(xElem))
     {
         undo.Group();
         using (EventsHelper elemHelper = new EventsHelper(xElem))
         {
             xElem.Add(toAdd);
             allNodes = contextNode == null ? xElem.Nodes() : contextNode.NodesAfterSelf();
             Assert.True(toAddList.SequenceEqual(allNodes, XNode.EqualityComparer), "Nodes not added correctly!");
             elemHelper.Verify(XObjectChange.Add, toAdd);
         }
         undo.Undo();
         Assert.True(xElem.Nodes().SequenceEqual(xElemOriginal.Nodes(), XNode.EqualityComparer), "Undo did not work!");
         Assert.True(xElem.Attributes().EqualsAllAttributes(xElemOriginal.Attributes(), Helpers.MyAttributeComparer), "Undo did not work!");
     }
 }
開發者ID:ESgarbi,項目名稱:corefx,代碼行數:20,代碼來源:EventsAdd.cs

示例2: parseXml

    private string parseXml(XNode root, int tabs)
    {
        string result = "<br />";
        if (root != null)
        {
            for (int i = 0; i < tabs; i++)
            {
                result += "&nbsp;&nbsp;&nbsp;&nbsp;";
            }
            result += root.ToString();
        }
        for (int i = 0; i < root.NodesAfterSelf().Count(); i++)
        {
            result += parseXml(root.NodesAfterSelf().ElementAt(i), tabs + 1);
        }

        return result;
    }
開發者ID:tylerbrockett,項目名稱:cse445-web-services,代碼行數:18,代碼來源:Default.aspx.cs

示例3: ExecuteXDocumentVariation

 public void ExecuteXDocumentVariation(XNode[] toAdd, XNode contextNode)
 {
     IEnumerable<XNode> allNodes, toAddList = toAdd.OfType<XNode>();
     XDocument xDoc = contextNode == null ? new XDocument() : new XDocument(contextNode);
     XDocument xDocOriginal = new XDocument(xDoc);
     using (UndoManager undo = new UndoManager(xDoc))
     {
         undo.Group();
         using (EventsHelper docHelper = new EventsHelper(xDoc))
         {
             xDoc.Add(toAdd);
             allNodes = contextNode == null ? xDoc.Nodes() : contextNode.NodesAfterSelf();
             Assert.True(toAddList.SequenceEqual(allNodes, XNode.EqualityComparer), "Nodes not added correctly!");
             docHelper.Verify(XObjectChange.Add, toAdd);
         }
         undo.Undo();
         Assert.True(XNode.DeepEquals(xDoc, xDocOriginal), "Undo did not work!");
     }
 }
開發者ID:ESgarbi,項目名稱:corefx,代碼行數:19,代碼來源:EventsAdd.cs


注:本文中的System.Xml.Linq.XNode.NodesAfterSelf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。