# ardalis/SmartEnum

A base class for quickly and easily creating strongly typed enum replacements in C#.

Repository: https://github.com/ardalis/SmartEnum
Canonical: https://ross.abutalabs.com/products/smartenum
Language: C#
License: MIT
License Family: permissive
Topics: clean, csharp, ddd, design-patterns, domain-driven-design, dotnet, dotnet-core, enum, hacktoberfest
Last push: 2026-04-29T05:51:57+00:00

## Health v2 (maintenance only)
Score: 65/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 79, release rhythm 28, longevity 100
- inputs: {"age_days": 3197, "days_push": 126, "days_rel": 652, "gap_med": 47, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2440, forks 184 (observed 2026-08-28T04:06:52.331085+00:00)

## What it is
A C# base class library for creating strongly-typed enum alternatives with behavior, lookup by name or value, and rich integration support. It ships companion packages for EF Core, Dapper, System.Text.Json, Json.NET, and AutoFixture.

## Use cases
- replace C# enums with strongly typed classes
- persist smart enums with EF Core
- serialize enums as names with System.Text.Json or Json.NET
- map smart enums with Dapper
- implement value objects in domain-driven design
- look up enum instances by name or value

## When to choose
- you need enums with behavior or additional properties in .NET
- you follow DDD and want type-safe value objects instead of primitive enums
- you need enum persistence and JSON serialization integrations out of the box

## When to avoid
- you only need simple flags or constants with no behavior
- your project is not on .NET/C#
- you want to avoid extra dependencies for trivial enum use cases

## Facets
- artifact type: library
- maturity: stable
- function: serialization, type-system, orm
- domain: developer-tools, programming-languages, backend
- platform: dotnet, c
- tags: smart-enum, enum-alternative, domain-driven-design, ddd, value-object, efcore, dapper, system-text-json, jsonnet, nuget

## Member repositories
- ardalis/SmartEnum (main) score 65

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:52.331085+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T02:30:44.115089+00:00, confidence not recorded.
  - readme: https://github.com/ardalis/SmartEnum (fetched 2026-08-28T04:06:52.331085+00:00, sha 76c23be632b2)
- Data as of 2026-08-30T08:39:29.467469+00:00.
