GeneratedRegexAttribute
Definition
Namespace: Corvus.Ecma262.RegularExpressions
Assembly: Corvus.Regex.Ecma262.dll
Source: GeneratedRegexAttribute.cs
Marks a static partial method or property that returns a Regex for the source generator, which checks the pattern at build time (a pattern that is not valid is a build error with the ECMA-262 message) and emits the member, as .NET's GeneratedRegexAttribute does.
public sealed class GeneratedRegexAttribute : Attribute
Inheritance
Object → Attribute → GeneratedRegexAttribute
Constructors
| Constructor | Description |
|---|---|
| GeneratedRegexAttribute(...) | Initializes a new instance of the GeneratedRegexAttribute class. |
Properties
| Property | Type | Description |
|---|---|---|
| Flags | RegexFlags |
Gets the flags. |
| FlagsText | string? |
Gets the flags as given in letters, or null when they were given as RegexFlags. |
| MatchTimeoutMilliseconds | int |
Gets the limit of time on a match in milliseconds, or -1 for none. |
| Pattern | string |
Gets the pattern. |
Example
csharp [GeneratedRegex(@"\d+", "gu")] private static partial Regex Digits();
Applies To
| Product | Versions |
|---|---|
| .NET | 9, 10 |
| .NET Standard | 2.0, 2.1 |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests.
Open an issue