Why does the IDE not recognize the Required attribute in the following code?
Imports System.ComponentModel.DataAnnotations
Public Class ShippingDetails
<Required()> _
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Private _Name As String
End Class
The error is:
Type ‘Required’ is not defined.
Make sure you are referencing System.ComponentModel.DataAnnotations.dll. The
RequiredAttributealso needs .NET 3.5 or above.