ValidationAttribute.FormatErrorMessage(String) ValidationAttribute.FormatErrorMessage(String) ValidationAttribute.FormatErrorMessage(String) ValidationAttribute.FormatErrorMessage(String) Method

定義

根據發生錯誤所在的資料欄位,將格式套用至錯誤訊息。Applies formatting to an error message, based on the data field where the error occurred.

public:
 virtual System::String ^ FormatErrorMessage(System::String ^ name);
public virtual string FormatErrorMessage (string name);
abstract member FormatErrorMessage : string -> string
override this.FormatErrorMessage : string -> string
Public Overridable Function FormatErrorMessage (name As String) As String

參數

name
String String String String

要包含在格式化訊息中的名稱。The name to include in the formatted message.

傳回

格式化之錯誤訊息的執行個體。An instance of the formatted error message.

備註

這個方法會格式化錯誤訊息使用ErrorMessageString屬性。This method formats an error message by using the ErrorMessageString property. 這個方法會附加觸發要格式化的錯誤訊息的錯誤資料欄位的名稱。This method appends the name of the data field that triggered the error to the formatted error message. 您可以自訂如何藉由建立衍生的類別會覆寫此方法格式化的錯誤訊息。You can customize how the error message is formatted by creating a derived class that overrides this method.

適用於