-
-
Notifications
You must be signed in to change notification settings - Fork 1
API Reference
Taiizor edited this page Dec 18, 2024
·
4 revisions
public UUID()
public UUID(ulong timestamp, ulong random)
Property | Type | Description |
---|---|---|
Time |
DateTimeOffset |
The timestamp component of the UUID |
Random |
ulong |
The random component |
Method | Return Type | Description |
---|---|---|
New() |
UUID |
Creates a new UUID |
ToString() |
string |
32-character hexadecimal string |
ToBase32() |
string |
26-character Base32 encoded string |
ToBase64() |
string |
Base64 encoded string |
ToByteArray() |
byte[] |
16-byte array |
ToGuid() |
Guid |
Guid conversion |
Method | Parameters | Return Type | Description |
---|---|---|---|
Parse(string) |
input: string |
UUID |
Creates UUID from string |
TryParse(string?, out UUID) |
input: string?, result: out UUID |
bool |
Safe parsing operation |
FromBase64(string) |
base64: string |
UUID |
Creates UUID from Base64 string |
TryFromBase64(string, out UUID) |
base64: string, result: out UUID |
bool |
Safe Base64 parsing operation |
FromByteArray(byte[]) |
bytes: byte[] |
UUID |
Creates UUID from byte array |
TryFromByteArray(byte[], out UUID) |
bytes: byte[], result: out UUID |
bool |
Safe byte array parsing operation |
Method | Parameters | Return Type | Description |
---|---|---|---|
FromGuid(Guid) |
guid: Guid |
UUID |
Creates UUID from Guid |
TryWriteBytes(byte[]) |
destination: byte[] |
bool |
Writes to byte array |
TryWriteStringify(char[]) |
destination: char[] |
bool |
Writes to char array |
TryWriteBytes(Span<byte>) |
destination: Span<byte> |
bool |
Writes to byte span |
public static implicit operator UUID(Guid guid)
public static implicit operator Guid(UUID uuid)
public static bool operator ==(UUID left, UUID right)
public static bool operator !=(UUID left, UUID right)
public static bool operator <(UUID left, UUID right)
public static bool operator <=(UUID left, UUID right)
public static bool operator >(UUID left, UUID right)
public static bool operator >=(UUID left, UUID right)
The UUID struct implements the following interfaces:
IEquatable<UUID>
IComparable<UUID>
IComparable
Constant | Type | Value | Description |
---|---|---|---|
SIZE |
int |
16 |
UUID size in bytes |
All public methods are thread-safe. Thread safety is achieved through:
- Immutable struct design
- ThreadLocal random number generator
- Lock-free operations
Operation | Time Complexity | Space Complexity |
---|---|---|
Creation | O(1) | O(1) |
Comparison | O(1) | O(1) |
Parse/ToString | O(n) | O(n) |
ToBase32/64 | O(n) | O(n) |
Here, n represents the length of the output string, where n denotes the output size in terms of the number of characters or bytes.
- Check our FAQ section
- Visit Debugging and Diagnostics
- Review Performance guidelines
- Join our Discord community
- Ask on Stack Overflow
- Report issues on GitHub