-
-
Notifications
You must be signed in to change notification settings - Fork 3
Quick Start
Taiizor edited this page Dec 28, 2024
·
5 revisions
// Create a new UUID
UUID id = new UUID();
// or
UUID id = UUID.New();// Convert to string
string str = id.ToString();
// Parse from string
UUID parsed = UUID.Parse("0123456789ABCDEF0123456789ABCDEF");
// Safe parsing
if (UUID.TryParse(input, out UUID result))
{
// Success
}// Base32 format
string base32 = id.ToBase32();
// Base64 format
string base64 = id.ToBase64();
// Byte array
byte[] bytes = id.ToByteArray();// UUID to Guid
Guid guid = id;
// Guid to UUID
UUID fromGuid = guid;UUID id1 = new UUID();
UUID id2 = new UUID();
// Comparison
bool areEqual = id1 == id2;
bool isGreater = id1 > id2;
// Access timestamp
DateTimeOffset timestamp = id1.Time;The UUID library is designed to be thread-safe and can be safely used in multi-threaded environments:
Parallel.For(0, 1000, _ => {
UUID id = new UUID();
// Thread-safe operations
});- Check our FAQ section
- Visit Debugging and Diagnostics
- Review Performance guidelines
- Join our Discord community
- Ask on Stack Overflow
- Report issues on GitHub