ReferenceGenerator: A Lightweight C# Library for Generating Unique References
Are you tired of writing custom code to generate reference numbers for your C# applications? Meet ReferenceGenerator, a flexible and lightweight library designed specifically for creating unique reference numbers in various formats.
🚀 Why You Need This Library
Whether you're working on an e-commerce platform that needs order numbers, a financial app requiring transaction IDs, or a document management system that needs reference codes - ReferenceGenerator has got you covered!
✨ Key Features
- Numeric references - perfect for sequential identifiers
- Alphabetic references (uppercase letters only) - great for category codes
- Alphanumeric references - for maximum flexibility
- GUID generation - when you need guaranteed uniqueness
- Cryptographically secure references - for security-sensitive applications
- Custom prefixes - easily add context to your references (e.g., "ORD-", "TXN-", "DOC-")
📦 Installation
Getting started is easy. Install via NuGet Package Manager:
Install-Package ReferenceGenerator
Or via .NET CLI:
dotnet add package ReferenceGenerator
💻 Usage Examples
The API is designed to be intuitive and straightforward:
using ReferenceGenerator;
// Generate a 10-digit numeric reference
string numericRef = ReferenceGenerator.GenerateNumeric(10);
// Example output: "1234567890"
// Generate an 8-character alphabetic reference
string alphabeticRef = ReferenceGenerator.GenerateAlphabetic(8);
// Example output: "ABCDEFGH"
// Generate a 12-character alphanumeric reference
string alphanumericRef = ReferenceGenerator.GenerateAlphanumeric(12);
// Example output: "A1B2C3D4E5F6"
// Generate a GUID
string guid = ReferenceGenerator.GenerateGuid();
// Example output: "550e8400-e29b-41d4-a716-446655440000"
// Generate references with prefixes
string orderRef = ReferenceGenerator.GenerateNumeric(6, "ORD-");
// Example output: "ORD-123456"
// Generate a cryptographically secure reference
string secureRef = ReferenceGenerator.GenerateSecure(10);
// Example output: "X7Y9Z2W4P5"
🛠️ Contributing
We believe in the power of community! Contributions are welcome and appreciated. Before submitting pull requests, please:
- Clone the repository
- Open the solution in Visual Studio or your preferred IDE
- Run the tests to ensure everything is working correctly
Speaking of tests, you can run them easily:
dotnet test
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
🆘 Support
Encountered an issue or have questions? We're here to help:
- Check existing issues in the GitHub repository
- Create a new issue if your problem hasn't been reported
- Provide as much detail as possible when reporting issues
Have you used ReferenceGenerator in your projects? Share your experience in the comments below! And don't forget to ⭐ the GitHub repo if you find it useful!
Top comments (0)