CSharp - Parsing an XML String into an Element

Description

Parsing an XML String into an Element

Demo

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

class Program//ww w.  ja  v  a2 s.  c  o m
{
    static void Main(string[] args){
          string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Books>" +
            "<Book type=\"Author\" experience=\"first-time\" language=" +
            "\"English\"><FirstName>Joe</FirstName><LastName>Ruby</LastName>" +
            "</Book></Books>";
    
          XElement xElement = XElement.Parse(xml);
          Console.WriteLine(xElement);
    }
}

Result