28 lines
733 B
C#
28 lines
733 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
|
|
namespace Microsoft.Extensions.WebEncoders
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static string[] ReadAllLines(this TextReader reader)
|
|
{
|
|
return ReadAllLinesImpl(reader).ToArray();
|
|
}
|
|
|
|
private static IEnumerable<string> ReadAllLinesImpl(TextReader reader)
|
|
{
|
|
string line;
|
|
while ((line = reader.ReadLine()) != null)
|
|
{
|
|
yield return line;
|
|
}
|
|
}
|
|
}
|
|
}
|