XElement_Extension.cs

24 lines | 685 B Blame History Raw Download
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Xml.Linq;

namespace yEd.XGML.IO.Read
{
    internal static class XElement_Extension
    {
        public static XElement GetChild_Section(this XElement element, string name) =>
               element.Elements("section")
                   .FirstOrDefault(e => e.Attribute("name")
                       .Value == name);

        public static XElement GetChild_Attribute(this XElement element, string key) =>
            element.Elements("attribute")
                .FirstOrDefault(e => e.Attribute("key")
                    .Value == key);
    }
}