Innovenergy_trunk/csharp/Lib/Utils/StreamExtensions.cs

16 lines
312 B
C#

namespace InnovEnergy.Lib.Utils;
public static class StreamExtensions
{
public static IEnumerable<Byte> AsEnumerable(this Stream s)
{
while (true)
{
var b = s.ReadByte();
if (b < 0)
yield break;
yield return (Byte)b;
}
}
}