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

Description

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

Example


    /*w w w .j a v  a  2  s .  com*/
using System;
using System.Linq;
using System.Xml.Linq;


public class MainClass{
   public static void Main(){
        XElement root;
        string[] stringArray = {"abc","def","ghi"};
        root = new XElement("Root", stringArray);
        Console.WriteLine(root);
        
        
    }
}




















Home »
  C# Tutorial »
    XML »




Load Parse
Document
Element
Attribute
Namespace
Query
Save
Schema
Style