Upraviť

Zdieľať cez


GeneratedRegexAttribute Class

Definition

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, AllowMultiple=false, Inherited=false)]
public sealed class GeneratedRegexAttribute : 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)>]
type GeneratedRegexAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property, AllowMultiple=false, Inherited=false)>]
type GeneratedRegexAttribute = class
    inherit Attribute
Public NotInheritable Class GeneratedRegexAttribute
Inherits Attribute
Inheritance
GeneratedRegexAttribute
Attributes

Remarks

The 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 return Regex.

When the Regex supports case-insensitive matches (either by passing IgnoreCase 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 the Regex engines, which perform this transformation at run time, meaning they will always use casing table for the current runtime.

Constructors

GeneratedRegexAttribute(String, RegexOptions, Int32, String)

Initializes a new instance of GeneratedRegexAttribute with the specified pattern, options, time-out value, and culture.

GeneratedRegexAttribute(String, RegexOptions, Int32)

Initializes a new instance of GeneratedRegexAttribute with the specified pattern, options, and time-out value.

GeneratedRegexAttribute(String, RegexOptions, String)

Initializes a new instance of GeneratedRegexAttribute with the specified pattern and options.

GeneratedRegexAttribute(String, RegexOptions)

Initializes a new instance of GeneratedRegexAttribute with the specified pattern and options.

GeneratedRegexAttribute(String)

Initializes a new instance of GeneratedRegexAttribute with the specified pattern.

Properties

CultureName

Gets the name of the culture to be used for case sensitive comparisons.

MatchTimeoutMilliseconds

Gets a time-out interval (milliseconds), or Infinite 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 this Attribute.

(Inherited from Attribute)

Methods

Equals(Object)

Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode()

Returns the hash code for this instance.

(Inherited from Attribute)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute()

When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object)

When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to