[DllImport("rpcrt4.dll", SetLastError = true)]
static extern int UuidCreateSequential(out Guid guid);
public static Guid GenerateSequentialGuid()
{
Guid guid;
int result = UuidCreateSequential(out guid);
if (result != 0)
{
throw new ApplicationException("Create sequential guid failed: " + result);
}
return guid;
}