CSharp - Creating CData with XCData

Description

Creating CData with XCData

Demo

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

class Program//w ww  .  j a v  a2 s .  c om
{
    static void Main(string[] args){
          XElement xErrorMessage = new XElement("HTMLMessage",
                                     new XCData("<H1>Invalid user id or password.</H1>"));
    
          Console.WriteLine(xErrorMessage);
    }
}

Result