![]() |
VOOZH | about |
dotnet add package Enigmatry.Entry.SmartEnums --version 10.2.3
NuGet\Install-Package Enigmatry.Entry.SmartEnums -Version 10.2.3
<PackageReference Include="Enigmatry.Entry.SmartEnums" Version="10.2.3" />
<PackageVersion Include="Enigmatry.Entry.SmartEnums" Version="10.2.3" />Directory.Packages.props
<PackageReference Include="Enigmatry.Entry.SmartEnums" />Project file
paket add Enigmatry.Entry.SmartEnums --version 10.2.3
#r "nuget: Enigmatry.Entry.SmartEnums, 10.2.3"
#:package Enigmatry.Entry.SmartEnums@10.2.3
#addin nuget:?package=Enigmatry.Entry.SmartEnums&version=10.2.3Install as a Cake Addin
#tool nuget:?package=Enigmatry.Entry.SmartEnums&version=10.2.3Install as a Cake Tool
A library that extends the traditional C# enum concept with rich, type-safe enumeration classes that can contain both data and behavior.
Use Smart Enums when you need enumerations that contain additional data and behavior beyond simple named constants. Smart Enums provide type-safety, better refactoring support, and the ability to encapsulate logic related to the enumeration.
Add the package to your project:
dotnet add package Enigmatry.Entry.SmartEnums
Define a Smart Enum:
using Enigmatry.Entry.SmartEnums;
public class PaymentMethod : SmartEnum<PaymentMethod>
{
public static readonly PaymentMethod CreditCard = new(1, nameof(CreditCard), "Credit Card", 0.02m);
public static readonly PaymentMethod DebitCard = new(2, nameof(DebitCard), "Debit Card", 0.01m);
public static readonly PaymentMethod BankTransfer = new(3, nameof(BankTransfer), "Bank Transfer", 0.00m);
public string DisplayName { get; }
public decimal TransactionFee { get; }
private PaymentMethod(int id, string name, string displayName, decimal transactionFee)
: base(id, name)
{
DisplayName = displayName;
TransactionFee = transactionFee;
}
public decimal CalculateFee(decimal amount) => amount * TransactionFee;
}
Using the Smart Enum:
// Get by name
var creditCard = PaymentMethod.FromName("CreditCard");
// Get by ID
var bankTransfer = PaymentMethod.FromId(3);
// Use the properties and methods
decimal fee = creditCard.CalculateFee(100.00m);
// List all values
var allMethods = PaymentMethod.List();
// Equality comparison works correctly
bool isSame = (PaymentMethod.CreditCard == creditCard); // true
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 4 NuGet packages that depend on Enigmatry.Entry.SmartEnums:
| Package | Downloads |
|---|---|
|
Enigmatry.Entry.SmartEnums.VerifyTests
Building Block for support of SmartEnums with VerifyTests in an Entry based project |
|
|
Enigmatry.Entry.SmartEnums.EntityFramework
Building Block for support of SmartEnums with EntityFramework in an Entry based project |
|
|
Enigmatry.Entry.SmartEnums.Swagger
Building Block for support of SmartEnums with NSWag in an Entry based project |
|
|
Enigmatry.Entry.SmartEnums.SystemTextJson
Building Block for support of SmartEnums with SystemTextJson in an Entry based project |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.2.3 | 144 | 6/1/2026 |
| 10.2.3-preview.4 | 77 | 6/1/2026 |
| 10.2.2 | 247 | 4/27/2026 |
| 10.2.1-preview.1 | 62 | 4/27/2026 |
| 10.1.0 | 259 | 4/16/2026 |
| 10.0.1 | 146 | 5/19/2026 |
| 10.0.1-preview.2 | 70 | 4/16/2026 |
| 10.0.0 | 140 | 4/2/2026 |
| 9.6.0 | 167 | 3/18/2026 |
| 9.5.0 | 261 | 1/26/2026 |
| 9.4.0 | 411 | 12/22/2025 |
| 9.3.1-preview.3 | 271 | 12/18/2025 |
| 9.3.1-preview.1 | 182 | 11/25/2025 |
| 9.3.0 | 897 | 11/10/2025 |
| 9.2.0 | 284 | 9/24/2025 |
| 9.1.1-preview.5 | 237 | 8/8/2025 |
| 9.1.1-preview.4 | 144 | 6/27/2025 |
| 8.3.1-preview.1 | 155 | 12/24/2025 |
| 8.3.0 | 266 | 12/23/2025 |
| 8.2.0 | 294 | 9/24/2025 |