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/Nitride/Contents/TextContentExtensions.cs

22 lines
462 B
C#
Raw Normal View History

2021-09-07 05:15:45 +00:00
using System.IO;
namespace Nitride.Contents;
public static class TextContentExtensions
2021-09-07 05:15:45 +00:00
{
public static string GetText(this ITextContent content)
2021-09-07 05:15:45 +00:00
{
var writer = new StringWriter();
using TextReader reader = content.GetReader();
string? line = reader.ReadLine();
2021-09-07 05:15:45 +00:00
while (line != null)
{
writer.WriteLine(line);
line = reader.ReadLine();
2021-09-07 05:15:45 +00:00
}
return writer.ToString();
2021-09-07 05:15:45 +00:00
}
}