C# .NET 利用系统API生成有序GUID

[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;
}