This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Instructs the System.Text.RegularExpressions source generator to generate an implementation of the specified regular expression.
public ref class GeneratedRegexAttribute sealed : Attribute[System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)]public sealed class GeneratedRegexAttribute : Attribute[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)]public sealed class GeneratedRegexAttribute : Attribute[<System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)>]type GeneratedRegexAttribute = class inherit Attribute[<System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false, Inherited=false)>]type GeneratedRegexAttribute = class inherit AttributePublic NotInheritable Class GeneratedRegexAttributeInherits AttributeThe generator associated with this attribute only supports C#. It only supplies an implementation when applied to partial, parameterless, non-generic methods that are typed to returnRegex.
When theRegex supports case-insensitive matches (either by passingIgnoreCase or using the inline `(?i)` switch in the pattern) the regex engines will use an internal casing table to transform the passed in pattern into an equivalent case-sensitive one. For example, given the pattern `abc`, the engines will transform it to the equivalent pattern `[Aa][Bb][Cc]`. The equivalences found in this internal casing table can change over time, for example in the case new characters are added to a new version of Unicode. When using the source generator, this transformation happens at compile time, which means the casing table used to find the equivalences will depend on the target framework at compile time. This differs from the rest of theRegex engines, which perform this transformation at run time, meaning they will always use casing table for the current runtime.
| Name | Description |
|---|---|
| GeneratedRegexAttribute(String, RegexOptions, Int32, String) | Initializes a new instance ofGeneratedRegexAttribute with the specified pattern, options, time-out value, and culture. |
| GeneratedRegexAttribute(String, RegexOptions, Int32) | Initializes a new instance ofGeneratedRegexAttribute with the specified pattern, options, and time-out value. |
| GeneratedRegexAttribute(String, RegexOptions, String) | Initializes a new instance ofGeneratedRegexAttribute with the specified pattern and options. |
| GeneratedRegexAttribute(String, RegexOptions) | Initializes a new instance ofGeneratedRegexAttribute with the specified pattern and options. |
| GeneratedRegexAttribute(String) | Initializes a new instance ofGeneratedRegexAttribute with the specified pattern. |
| Name | Description |
|---|---|
| CultureName | Gets the name of the culture to be used for case-insensitive comparisons. |
| MatchTimeoutMilliseconds | Gets a time-out interval (milliseconds), orInfinite to indicate that the method should not time out. |
| Options | Gets a bitwise combination of the enumeration values that modify the regular expression. |
| Pattern | Gets the regular expression pattern to match. |
| TypeId | When implemented in a derived class, gets a unique identifier for thisAttribute. (Inherited fromAttribute) |
| Name | Description |
|---|---|
| Equals(Object) | Returns a value that indicates whether this instance is equal to a specified object. (Inherited fromAttribute) |
| GetHashCode() | Returns the hash code for this instance. (Inherited fromAttribute) |
| GetType() | Gets theType of the current instance. (Inherited fromObject) |
| IsDefaultAttribute() | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited fromAttribute) |
| Match(Object) | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited fromAttribute) |
| MemberwiseClone() | Creates a shallow copy of the currentObject. (Inherited fromObject) |
| ToString() | Returns a string that represents the current object. (Inherited fromObject) |
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?