ApiExamples.ExNode.IndexChildNodes C# (CSharp) Метод

IndexChildNodes() приватный Метод

private IndexChildNodes ( ) : void
Результат void
        public void IndexChildNodes()
        {
            Document doc = new Document();
            Paragraph paragraph = (Paragraph)doc.GetChild(NodeType.Paragraph, 0, true);

            //ExStart
            //ExFor:NodeCollection.Count
            //ExFor:NodeCollection.Item
            //ExId:ChildNodesIndexer
            //ExSummary:Shows how to enumerate immediate children of a CompositeNode using indexed access.
            NodeCollection children = paragraph.ChildNodes;
            for (int i = 0; i < children.Count; i++)
            {
                Node child = children[i];

                // Paragraph may contain children of various types such as runs, shapes and so on.
                if (child.NodeType.Equals(NodeType.Run))
                {
                    // Say we found the node that we want, do something useful.
                    Run run = (Run)child;
                    Console.WriteLine(run.Text);
                }
            }
            //ExEnd
        }