This code :
IEnumerable lines = File.ReadLines(\"file path\");
foreach (var line in lines)
{
Console.WriteLine(line);
}
foreach (var line
I don't know if it can be considered a bug or not if it's by design but I can certainly say two things...
You are correct in noting that returning an IEnumerable implies that it should be reusable and it does not guarantee the same results if iterated twice. If it had returned an IEnumerator instead then it would be a different story.
So anyway, I think it's a good find and I think the API is a lousy one to begin with. ReadAllLines and ReadAllText give you a nice convenient way of getting at the entire file but if the caller cares enough about performance to be using a lazy enumerable, they shouldn't be delegating so much responsibility to a static helper method in the first place.