Skip to content

Instantly share code, notes, and snippets.

@maxfridbe
maxfridbe / gist:b6ad5196894826741cb8fc154986d06f
Created April 9, 2019 16:26 — forked from pmn/gist:1145504
C# Comb Guid generation
// C# Comb Guid generation
// Found at http://stackoverflow.com/questions/665417/sequential-guid-in-linq-to-sql/2187898#2187898
Guid GenerateComb()
{
byte[] destinationArray = Guid.NewGuid().ToByteArray();
DateTime time = new DateTime(0x76c, 1, 1);
DateTime now = DateTime.Now;
TimeSpan span = new TimeSpan(now.Ticks - time.Ticks);
TimeSpan timeOfDay = now.TimeOfDay;