Innovenergy_trunk/csharp/Lib/Utils/StreamExtensions.cs

16 lines
312 B
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
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;
}
}
}