.Net 7.0 Regex SourceGen #67644
-
@stephentoub is doing amazing work on the regex source gen.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Thank you.
There are a few answers here:
That's the plan.
There aren't that many regexes used in the core libraries, but the ones that are there and employ a constant pattern have mostly all been moved over already, e.g. https://github.com/dotnet/winforms/blob/1616cf133035beadf3c97573c8abecbdb6750967/src/System.Windows.Forms/src/System/Windows/Forms/ToolStripSettingsManager.cs#L212-L213 and so on.
As high-level guidance, if a regex pattern is known at compile-time (rather than being dynamically-generated at run-time) and performance of the regex matters (e.g. it's something you would have previously used RegexOptions.Compiled for), it should use the source generator instead. |
Beta Was this translation helpful? Give feedback.
Thank you.
There are a few answers here: