1
This commit is contained in:
15
Yes.Infrastructure/Rss/XDocumentExtensions.cs
Normal file
15
Yes.Infrastructure/Rss/XDocumentExtensions.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Yes.Infrastructure.Rss
|
||||
{
|
||||
public static class XDocumentExtensions
|
||||
{
|
||||
public static string ToStringWithDeclaration(this XDocument doc)
|
||||
{
|
||||
if (doc.Declaration == null)
|
||||
return doc.ToString();
|
||||
|
||||
using var writer = new StringWriter();
|
||||
doc.Save(writer);
|
||||
return writer.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user