CSharp examples for System.Xml:XML Element
First XML Element from Any Namespace
using System.Xml.Linq; using System.Linq; using System.Collections.Generic; public class Main{ public static XElement FirstAnyNS<T>(this IEnumerable<T> source, string localName) where T : XContainer {/*from w ww. ja va2 s.co m*/ return source.Elements().Where(e => e.Name.LocalName == localName).FirstOrDefault(); } }