public static IEnumerable<string> ReadLines(this Stream stream)
{
if (stream == null)
throw new ArgumentNullException("stream");
using (var reader = new StreamReader(stream))
{
string line;
while ((line = reader.ReadLine()) != null)
{
yield return line;
}
}
}