Прочетете на английски Редактиране

Споделяне чрез


Guid.CreateVersion7 Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

CreateVersion7()

Creates a new Guid according to RFC 9562, following the Version 7 format.

CreateVersion7(DateTimeOffset)

Creates a new Guid according to RFC 9562, following the Version 7 format.

CreateVersion7()

Creates a new Guid according to RFC 9562, following the Version 7 format.

C#
public static Guid CreateVersion7();

Returns

A new Guid according to RFC 9562, following the Version 7 format.

Remarks

This method uses UtcNow to determine the Unix Epoch timestamp source.

This method seeds the rand_a and rand_b sub-fields with random data.

Applies to

.NET 10 и .NET 9
Продукт Версии
.NET 9, 10

CreateVersion7(DateTimeOffset)

Creates a new Guid according to RFC 9562, following the Version 7 format.

C#
public static Guid CreateVersion7(DateTimeOffset timestamp);

Parameters

timestamp
DateTimeOffset

The date-time offset used to determine the Unix Epoch timestamp.

Returns

A new Guid according to RFC 9562, following the Version 7 format.

Exceptions

timestamp represents an offset prior to UnixEpoch.

Remarks

This method seeds the rand_a and rand_b sub-fields with random data.

Applies to

.NET 10 и .NET 9
Продукт Версии
.NET 9, 10