This repository has been archived on 2023-02-02. You can view files and clone it, but cannot push or open issues or pull requests.
mfgames-nitride-cil/src/MfGames.Nitride.Feeds/Structure/AtomHelper.cs
D. Moonfire 9e93eb6ce6 refactor!: fixed missed namespaces
- reformatted code and cleaned up references
2023-01-14 18:19:42 -06:00

34 lines
672 B
C#

using System.Xml.Linq;
namespace MfGames.Nitride.Feeds.Structure;
/// <summary>
/// Helper methods for working with XML elements.
/// </summary>
public static class AtomHelper
{
public static void AddIfSet(
XElement root,
XElement? elem)
{
if (elem != null)
{
root.Add(elem);
}
}
public static void AddIfSet(
XElement elem,
string name,
string? text)
{
if (!string.IsNullOrWhiteSpace(text))
{
elem.Add(
new XElement(
XmlConstants.AtomNamespace + name,
new XText(text)));
}
}
}