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)

Syntax

'Declaration
Public Overrides Function IsValid ( _
    value As Object _
) As Boolean
'Usage
Dim instance As MaxLengthAttribute
Dim value As Object
Dim returnValue As Boolean

returnValue = instance.IsValid(value)
public override bool IsValid(
    Object value
)
public:
virtual bool IsValid(
    Object^ value
) override
abstract IsValid : 
        value:Object -> bool 
override IsValid : 
        value:Object -> bool 
public override function IsValid(
    value : Object
) : boolean

Parameters

Return Value

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

Exceptions

Exception Condition
InvalidOperationException

Length is zero or less than negative one.

Remarks

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

See Also

Reference

MaxLengthAttribute Class

IsValid Overload

System.ComponentModel.DataAnnotations Namespace