Create an XElement from tag name and DateTime value in CSharp
Description
The following code shows how to create an XElement from tag name and DateTime value.
Example
/*from w w w . jav a2s . c om*/
using System;
using System.Linq;
using System.Xml.Linq;
public class MainClass{
public static void Main(){
XElement root;
DateTime dt = new DateTime(2010, 10, 6, 12, 30, 00);
root = new XElement("Root", dt);
Console.WriteLine(root);
}
}