Skip to content
This repository has been archived by the owner on Jan 9, 2025. It is now read-only.

Ambiguity in description of .NET regular expression source generators #3977

Closed
SetTrend opened this issue Jan 18, 2024 · 1 comment
Closed
Labels
bug Something isn't working Pri3

Comments

@SetTrend
Copy link

SetTrend commented Jan 18, 2024

In section Source generation, the documentation states:

The generated implementation of AbcOrDefGeneratedRegex() similarly caches a singleton Regex instance, so no additional caching is needed to consume code.

… but right below that you're providing a screenshot that's manually caching the generated RegEx() result in user code:

cached instance

What's true? — Do we need to cache the result in a static readonly variable or can we call RegEx() repeatedly without penalty to runtime execution time?


https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-source-generators#source-generation

@SetTrend SetTrend added the bug Something isn't working label Jan 18, 2024
@gewarren
Copy link
Member

This issue was moved to dotnet/docs#39299

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Pri3
Projects
None yet
Development

No branches or pull requests

2 participants