JD2022-TU1/main/tools/services/JD.SonyTrophy.Service/Extension/XElementExtension.cs

22 lines
574 B
C#

using System.Xml.Linq;
namespace JD.SonyTrophy.Service.Extension
{
public static class XElementExtension
{
public static XElement AddElement(this XElement element, string name, string value = null)
{
XElement child = null;
if (element != null)
{
child = new XElement(XName.Get(name, element.Name.NamespaceName))
{
Value = value ?? string.Empty
};
element.Add(child);
}
return child;
}
}
}