語言

MatchEvaluator 代理人

定義

表示每次在方法操作中 Replace(String, MatchEvaluator) 找到正則表達式匹配時所呼叫的方法。

public delegate System::String ^ MatchEvaluator(Match ^ match);
public delegate string MatchEvaluator(Match match);
[System.Serializable]
public delegate string MatchEvaluator(Match match);
type MatchEvaluator = delegate of Match -> string
[<System.Serializable>]
type MatchEvaluator = delegate of Match -> string
Public Delegate Function MatchEvaluator(match As Match) As String 

參數

match
Match

Match代表單一正則表達式的物件在方法Replace(String, MatchEvaluator)操作中匹配。

傳回值

由該方法回傳的字串,該字串由 MatchEvaluator 代理所代表。

屬性

備註

你可以使用 MatchEvaluator 代理方法,對每個由替換方法(如 Replace(String, MatchEvaluator))找到的匹配進行自訂驗證或操作操作。 對於每個匹配的字串,方法 Replace(String, MatchEvaluator) 會呼叫 MatchEvaluator 代表 Match 該匹配的物件的代理方法。 代理方法執行你偏好的處理方式,並回傳一個字串, Replace(String, MatchEvaluator) 該字串被方法替換為匹配的字串。

擴充方法

名稱 Description
GetMethodInfo(Delegate)

取得一個代表指定代理所代表方法的物件。

適用於

另請參閱