MaxLengthAttribute.IsValid Method (Object)

Determines whether a specified object is valid. (Overrides <see cref="M:System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(System.Object)" />)

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  EntityFramework (in EntityFramework.dll)

public override bool IsValid(
	Object value
)

Parameters

value
Type: System.Object
The object to validate.

Return Value

Type: System.Boolean
true if the value is null or less than or equal to the specified maximum length, otherwise false

ExceptionCondition
InvalidOperationException

Length is zero or less than negative one.

This method returns true if the value is null. It is assumed the RequiredAttribute is used if the value may not be null.

Show: