Interface annotations

Why annotations do not work in interfaces?

as:

public interface  IUser
{
    [Required]
    string FirstName { get; set; }
}

now if i created a class to implement this

 public partial class Customer:IUser
{
    public Customer()
    {
    }

    public string FirstName
    {
        get; set;
    }
}

it will not force check if I do not mark a property in the class! so what's the point of annotating it in the interface from the first place !! so any idea?

+3
source share
1 answer

, , . , Attribute.GetAttribute() ( inherit is true) , , . , , .

+4

Source: https://habr.com/ru/post/1756945/


All Articles