RangeAttribute.FormatErrorMessage(String) Método

Definição

Formata a mensagem de erro é exibida quando há falha na validação de intervalo.Formats the error message that is displayed when range validation fails.

public:
 override System::String ^ FormatErrorMessage(System::String ^ name);
public override string FormatErrorMessage (string name);
override this.FormatErrorMessage : string -> string
Public Overrides Function FormatErrorMessage (name As String) As String

Parâmetros

name
String

O nome do campo que causou a falha de validação.The name of the field that caused the validation failure.

Retornos

String

A mensagem de erro formatada.The formatted error message.

Exceções

O atributo atual está malformado.The current attribute is ill-formed.

Comentários

O FormatErrorMessage cria a mensagem de erro usando o nome do campo de dados que causou a falha de validação.The FormatErrorMessage creates the error message by using the name of the data field that caused the validation failure. Você pode substituir esse método em um atributo de validação personalizado para personalizar como os erros são criados ou para fornecer uma mensagem mais complexa que contenha parâmetros que você avalia em tempo de execução.You can override this method in a custom validation attribute to customize how errors are created, or to provide a more complex message that contains parameters that you evaluate at run time. Para ver um exemplo, consulte o construtor RangeAttribute.RangeAttribute.For an example, see the RangeAttribute.RangeAttribute constructor.

Aplica-se a