Skip to content

Instantly share code, notes, and snippets.

@motowilliams
Created October 23, 2011 20:43
Show Gist options
  • Save motowilliams/1307868 to your computer and use it in GitHub Desktop.
Save motowilliams/1307868 to your computer and use it in GitHub Desktop.
Stupid-Linq-Tricks-Record-Rollup
private static IEnumerable<RawRecords> GetSampleRow()
{
var timestamp1 = new DateTime(2010, 3, 12);
return new List<RawRecords>
{
new RawRecords { Sequence = 4, Id = 42, Timestamp = timestamp1, Comment = "et malesuada fames " },
new RawRecords { Sequence = 1, Id = 42, Timestamp = timestamp1, Comment = "Pellentesque habitant " },
new RawRecords { Sequence = 3, Id = 42, Timestamp = timestamp1, Comment = "senectus et netus " },
new RawRecords { Sequence = 5, Id = 42, Timestamp = timestamp1, Comment = "ac turpis egestas." },
new RawRecords { Sequence = 2, Id = 42, Timestamp = timestamp1, Comment = "morbi tristique " },
};
}
private static IEnumerable<RawRecords> GetSampleRows()
{
var timestamp1 = new DateTime(2010, 3, 12);
var timestamp2 = new DateTime(2010, 3, 13);
return new List<RawRecords>
{
new RawRecords { Sequence = 4, Id = 42, Timestamp = timestamp1, Comment = "et malesuada fames " },
new RawRecords { Sequence = 3, Id = 42, Timestamp = timestamp1, Comment = "senectus et netus " },
new RawRecords { Sequence = 4, Id = 69, Timestamp = timestamp2, Comment = "ante." },
new RawRecords { Sequence = 2, Id = 42, Timestamp = timestamp1, Comment = "morbi tristique " },
new RawRecords { Sequence = 1, Id = 42, Timestamp = timestamp1, Comment = "Pellentesque habitant " },
new RawRecords { Sequence = 1, Id = 69, Timestamp = timestamp2, Comment = "Vestibulum tortor quam, " },
new RawRecords { Sequence = 2, Id = 69, Timestamp = timestamp2, Comment = "feugiat vitae, ultricies " },
new RawRecords { Sequence = 3, Id = 69, Timestamp = timestamp2, Comment = "eget, tempor sit amet, " },
new RawRecords { Sequence = 5, Id = 42, Timestamp = timestamp1, Comment = "ac turpis egestas." },
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment