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/AtomAuthor.cs

38 lines
865 B
C#
Raw Normal View History

2021-09-07 05:15:45 +00:00
using System.Xml.Linq;
2022-09-06 05:53:22 +00:00
namespace MfGames.Nitride.Feeds.Structure;
/// <summary>
/// The type-safe structure for an author element.
/// </summary>
[WithProperties]
public partial class AtomAuthor
2021-09-07 05:15:45 +00:00
{
/// <summary>
/// Gets or sets the name of the author.
2021-09-07 05:15:45 +00:00
/// </summary>
public string? Name { get; set; }
2021-09-07 05:15:45 +00:00
/// <summary>
/// Creates an XML element out of the feed along with all items inside
/// the feed.
/// </summary>
/// <returns></returns>
public XElement? ToXElement()
{
if (this.Name == null)
2021-09-07 05:15:45 +00:00
{
return null;
}
2021-09-07 05:15:45 +00:00
var author = new XElement(XmlConstants.AtomNamespace + "author");
2021-09-07 05:15:45 +00:00
if (!string.IsNullOrEmpty(this.Name))
{
author.Add(new XElement(XmlConstants.AtomNamespace + "name", new XText(this.Name)));
2021-09-07 05:15:45 +00:00
}
return author;
2021-09-07 05:15:45 +00:00
}
}