Skip to content

Regex TagValidation — [GeneratedRegex] Source Generator #147

@leecampbell-codeagent

Description

@leecampbell-codeagent

File: HistogramBase.cs

private static readonly Regex TagValidation = new Regex("[, \\r\\n]", RegexOptions.Compiled);

On .NET 8 this should use the [GeneratedRegex] source generator, which produces fully AOT-safe, allocation-free regex matching with no startup compilation cost:

[GeneratedRegex("[, \\r\\n]")]
private static partial Regex TagValidation();

Minor on its own, but it's the right modern pattern and eliminates the compiled-regex warm-up allocation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions