Implementation of GroupBy in .NET
If you want to duplicate GroupBy semantics exactly, there are several things missing:


Eager error checking on parameters instead of deferred
The correct order of the groups (GroupBy guarantees that the groups are ordered by the relative order of the group's first element in the source)
Allowing keys that are null


You may be interested in Jon Skeet's recent blog postings.