Create an XElement from tag name and XElement array value in CSharp

Description

The following code shows how to create an XElement from tag name and XElement array value.

Example


    //from  w ww. j a va2  s .  co m
using System;
using System.Linq;
using System.Xml.Linq;


public class MainClass{
   public static void Main(){
        XElement root;
        XElement[] ellArray = {
            new XElement("NewChild1", 1),
            new XElement("NewChild3", 3)
        };
        root = new XElement("Root", ellArray);
        Console.WriteLine(root);
        
    }
}




















Home »
  C# Tutorial »
    XML »




Load Parse
Document
Element
Attribute
Namespace
Query
Save
Schema
Style