You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2021. It is now read-only.
var sw = new StringWriterWithEncoding(Encoding.UTF8);
using (XmlWriter xmlWriter = XmlWriter.Create(sw, new XmlWriterSettings() { Async = true, Indent = true }))
{
var writer = new RssFeedWriter(xmlWriter);
// Create item
var item = new SyndicationItem()
{
Title = "Rss Writer Avaliable",
Description = "The new Rss Writer is now available as a NuGet Package!",
Id = "https://www.nuget.org/packages/Microsoft.SyndicationFeed.ReaderWriter",
Published = DateTimeOffset.UtcNow
};
item.AddCategory(new SyndicationCategory("Technology"));
item.AddContributor(new SyndicationPerson("test", "test@mail.com"));
await writer.Write(item);
xmlWriter.Flush();
}
class StringWriterWithEncoding : StringWriter
{
private readonly Encoding _encoding;
public StringWriterWithEncoding(Encoding encoding)
{
this._encoding = encoding;
}
public override Encoding Encoding {
get { return _encoding; }
}
}
Actual output:
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel><item>
<title>Rss Writer Avaliable</title>
<description>The new Rss Writer is now available as a NuGet Package!</description>
<author>test@mail.com</author>
<category>Technology</category>
<guid isPermaLink="false">https://www.nuget.org/packages/Microsoft.SyndicationFeed.ReaderWriter</guid>
<pubDate>Mon, 24 Aug 2020 02:59:48 GMT</pubDate>
</item>