Awesome
Blowin.Required
Source | Link |
---|---|
VSIX | |
Nuget |
Implementation of proposal 'Required Properties' https://github.com/dotnet/csharplang/issues/3630
Add required attribute to property and enjoy :)
public class Person
{
public string Name { get; set; }
[Required]
public int Age { get; set; }
}
You can use DataAnnotation, or any attribute with name Required
Support diagnostics:
- Required property must be initialized (initializer)
- Type can't be used as generic parameter with new() restriction
- If constructor initialization of required property, it should be initialized in any execution path
Success cases:
Fail cases: