Copied struct Buffer from Microsoft's Enumerable.cs