Quick Start - Taiizor/UUID GitHub Wiki
🚀 Quick Start
Basic Usage
Creating UUIDs
// Create a new UUID
UUID id = new UUID();
// or
UUID id = UUID.New();
String Operations
// 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
}
Different Formats
// Base32 format
string base32 = id.ToBase32();
// Base64 format
string base64 = id.ToBase64();
// Byte array
byte[] bytes = id.ToByteArray();
Guid Conversions
// UUID to Guid
Guid guid = id;
// Guid to UUID
UUID fromGuid = guid;
Comparison and Sorting
UUID id1 = new UUID();
UUID id2 = new UUID();
// Comparison
bool areEqual = id1 == id2;
bool isGreater = id1 > id2;
// Access timestamp
DateTimeOffset timestamp = id1.Time;
Thread-Safe Usage
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
});