Domanda veloce ...C# dati Annotazioni Interfaccia
Se metto una notazione nell'interfaccia ...
Say [Required]
posso ommit che la notazione nella classe C# per la proprietà?
cioè posso ...
Interface IFoo
{
[Required]
string Bar {get; set;}
}
Class Foo : IFoo
{
string Bar {get; set;}
}
o ho bisogno non solo di mettere la notazione nell'interfaccia e fare questo ...
Interface IFoo
{
string Bar {get; set;}
}
Class Foo : IFoo
{
[Required]
string Bar {get; set;}
}
Deve andare in classe. Vedi: http://bradwilson.typepad.com/blog/2011/08/interface-attributes-class-attributes.html –