XElement_Tools.cs

33 lines | 838 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.Write.Tools
{
    internal static class XElement_Tools
    {
        public static XElement CreateSection(string name) =>
            new XElement(
                "section",
                new XAttribute("name", name)
            );


        public static XElement CreateAttribute(string key, string type, string value) =>
            new XElement(
                "attribute",
                new XAttribute("key", key),
                new XAttribute("type", type)
            )
            { Value = value };

        public static XElement CreateAttribute(string key, string type, object value) =>
            CreateAttribute(key, type, value.ToString());

    }
}