CustomValidationAttribute.Method Property
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.
Gets the validation method.
public:
property System::String ^ Method { System::String ^ get(); };
public string Method { get; }
member this.Method : string
Public ReadOnly Property Method As String
Property Value
The name of the validation method.
Remarks
The custom method specified by this property must be public and static, and it must return a Boolean value. It must also take at least one input parameter that specifies the object to validate. This parameter can be strongly typed. If a process passes a value of a different type, type conversion will be attempted.
The specified method should return true
if a given object is valid. Otherwise it should return false
.
The custom method can also take parameters that specify a ValidationContext input value and a ValidationResult output value. The ValidationContext parameter provides additional context information that the method can use to determine the context that it is used in. The ValidationResult output parameter enables the method to return an error message.
If the method returns null
for the ValidationResult parameter or if it returns an empty value for the ErrorMessage property, the default FormatErrorMessage method will be called to compose the error message.
Applies to
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示