Get the name of element in CSharp

Description

The following code shows how to get the name of element.

Example


    /*from ww  w  . java 2s .  c  o m*/
using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections;
using System.Collections.Generic;


public class MainClass{
   public static void Main(){
        XNamespace ns = "http://www.domain.com";
        XElement el2 = new XElement(ns + "Root", "content");
        Console.WriteLine(el2.Name.Namespace);
   }
}




















Home »
  C# Tutorial »
    XML »




Load Parse
Document
Element
Attribute
Namespace
Query
Save
Schema
Style