-
-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
Taiizor edited this page Dec 28, 2024
·
5 revisions
UUID is distributed via NuGet. You can install it using one of the following methods:
Install-Package UUID
dotnet add package UUID
// Create a new UUID
UUID id = new UUID();
// Get string representation
string idString = id.ToString(); // "0123456789ABCDEF0123456789ABCDEF"
// Parse from string
string uuidString = "0123456789ABCDEF0123456789ABCDEF";
UUID parsed = UUID.Parse(uuidString);
// Try parse (safer)
UUID result;
if (UUID.TryParse(uuidString, out result))
{
// Successfully parsed
}
// From Guid
Guid guid = Guid.NewGuid();
UUID fromGuid = UUID.FromGuid(guid);
// To Guid
Guid toGuid = fromGuid.ToGuid();
UUID id = new UUID();
// Different string representations
string hex = id.ToString(); // Hexadecimal
string base32 = id.ToBase32(); // Base32
string base64 = id.ToBase64(); // Base64
// Thread-safe UUID generation
Parallel.For(0, 1000, _ => {
UUID id = new UUID();
// Use the ID safely across threads
});
- Check out Detailed Usage for advanced features
- Review Performance for optimization tips
- See Examples for more code samples
- Refer to API Reference for complete documentation
-
Performance in High-Load Scenarios
- Use the built-in thread-safe generation
- Consider bulk generation for batch operations
-
String Format Compatibility
- Use appropriate string format methods based on your needs
- Consider using Base32 for URL-safe strings
-
Memory Usage
- UUID struct is optimized for minimal memory footprint
- Use array pooling for bulk operations
- Check our FAQ section
- Visit Debugging and Diagnostics
- Review Performance guidelines
- Join our Discord community
- Ask on Stack Overflow
- Report issues on GitHub