Skip to content

V0.2 with ValuesType - #1

Merged
jsneedles merged 2 commits into
mainfrom
values_type_span
Oct 1, 2026
Merged

jsneedles merged 2 commits into
mainfrom
values_type_span

Conversation

@jsneedles

Copy link
Copy Markdown
Member
  • Replace CreateStaticReadonlyCollection with a new ValuesType setting (FancyEnumValuesType), available on the enum, on the assembly and as the MSBuild property FancyEnumValuesType:
    • Span (default): Values is a ReadOnlySpan<T> over static data in the assembly, with no allocation, no copy and no static field. Needs .NET 7+; byte/sbyte enums get it on every target.
    • InlineArray: 0.1's behavior, a storable [InlineArray] copy, plus AsSpan.
    • StaticCollection: a cached IReadOnlyList<T>, plus AsSpan, on every target.
  • Add HENUM017, a warning when an explicitly chosen ValuesType can't be generated for the target. Values is skipped for that target only, so multi-targeted builds still pass.
  • Narrow NoInlineArray to just the [InlineArray] struct. {Enum}Array is now generated only for flags enums (ListFlagMembers) and ValuesType = InlineArray.
  • Fix CS0616 for enums named Inline, where the generated InlineArray struct shadowed the attribute alias. The attribute is now fully qualified.
  • Tests: new ValuesType scenarios on .NET 10 and netstandard2.0, HENUM017 cases, and runtime checks (static data, independent copies, surviving await). The package smoke test now covers a byte enum on net48.
  • Benchmarks: one ValuesBenchmarks row per ValuesType.
  • Docs: settings, how-it-works, README (settings table, HENUM017, code sizes re-measured), regenerated examples, and a new CHANGELOG.md with 0.1 → 0.2 upgrade notes.
  • Bump version to 0.2.0.

@jsneedles jsneedles changed the title V0.2 with ValuesTypeSpan V0.2 with ValuesType Oct 1, 2026
@jsneedles
jsneedles merged commit 347a377 into main Oct 1, 2026
3 checks passed
@jsneedles
jsneedles deleted the values_type_span branch October 1, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant