Movatterモバイル変換


[0]ホーム

URL:


Skip to main contentSkip to in-page navigation

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

GeneratedRegexAttribute Class

Definition

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 Attribute
Public NotInheritable Class GeneratedRegexAttributeInherits 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 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.

Constructors

NameDescription
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.

Properties

NameDescription
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)

Methods

NameDescription
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)

Applies to

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. For more information, seeour contributor guide.

Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?