GeneratedRegexAttribute 類別

定義

指示 System.Text.RegularExpressions 來源產生器產生指定正則運算式的實作。

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, AllowMultiple=false, Inherited=false)>]
type GeneratedRegexAttribute = class
    inherit Attribute
Public NotInheritable Class GeneratedRegexAttribute
Inherits Attribute
繼承
GeneratedRegexAttribute
屬性

備註

與此屬性相關聯的產生器僅支援 C# 。 它只會在套用至類型為 傳回 Regex 的部分、無參數、非泛型方法時提供實作。

Regex當 支援不區分大小寫的比對時, (傳入 IgnoreCase 或使用內嵌 ' (?i) ' 參數在模式中) RegEx 引擎將會使用內部大小寫資料表,將傳入的模式轉換成對等區分大小寫的資料表。 例如,假設模式為 'abc',引擎會將它轉換成對等模式 '[Aa][Bb][Cc]'。 在此內部大小寫資料表中找到的等價可能會隨著時間而變更,例如,在新版 Unicode 中新增字元的情況。 使用來源產生器時,此轉換會在編譯時期發生,這表示用來尋找等價的大小寫資料表會在編譯時期取決於目標架構。 這與執行時間執行此轉換的 Regex 其餘引擎不同,這表示它們一律會針對目前的執行時間使用大小寫資料表。

建構函式

GeneratedRegexAttribute(String)

使用指定的模式,初始化 的新實例 GeneratedRegexAttribute

GeneratedRegexAttribute(String, RegexOptions)

使用指定的模式和選項,初始化 的新實例 GeneratedRegexAttribute

GeneratedRegexAttribute(String, RegexOptions, Int32)

使用指定的模式、選項和逾時值,初始化 的新實例 GeneratedRegexAttribute

GeneratedRegexAttribute(String, RegexOptions, Int32, String)

使用指定的模式、選項、逾時值和文化特性,初始化 的新實例 GeneratedRegexAttribute

GeneratedRegexAttribute(String, RegexOptions, String)

使用指定的模式和選項,初始化 的新實例 GeneratedRegexAttribute

屬性

CultureName

取得要用於區分大小寫比較的文化特性名稱。

MatchTimeoutMilliseconds

取得 (毫秒) 的逾時間隔,或 Infinite 表示方法不應該逾時。

Options

取得修改正則運算式之列舉值的位元組合。

Pattern

取得要符合的規則運算式模式。

TypeId

在衍生類別中實作時,取得這個 Attribute 的唯一識別碼。

(繼承來源 Attribute)

方法

Equals(Object)

傳回值,這個值指出此執行個體是否與指定的物件相等。

(繼承來源 Attribute)
GetHashCode()

傳回這個執行個體的雜湊碼。

(繼承來源 Attribute)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
IsDefaultAttribute()

在衍生類別中覆寫時,表示這個執行個體的值是衍生類別的預設值。

(繼承來源 Attribute)
Match(Object)

在衍生類別中覆寫時,會傳回值,表示這個執行個體是否等於指定物件。

(繼承來源 Attribute)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於