CSharp - Creating a Text Node and Passing It As the Value of a Created Element

Description

Creating a Text Node and Passing It As the Value of a Created Element

Demo

using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections.Generic;

class Program//from w  w w.ja  va 2 s .c o  m
{
    static void Main(string[] args){
          XText xName = new XText("Joe");
          XElement xFirstName = new XElement("FirstName", xName);
          Console.WriteLine(xFirstName);
    }
}

Result

Related Topic