I'm using [Required()] above a property in a simple class:
public class A
{
[Required()]
public string Str { get; set; }
public int Salary { get; set; }
}
In Main(), I create an instance of the class, WITHOUT setting the property:
static void Main(string[] args)
{
A a = new A();
}
I expected to get an exception, because I didn't set any value to Str property, but I don't get any. Did I miss the purpose of [Required]?