Currently I have this:
[SomeCustomAttribute]
public string Name { get; set; }
However, I want this attribute to decorate only the setter, not the getter. Is there a way to do that?
Auto-implemented properties enable you to quickly specify a property of a class without having to write code to Get and Set the property.
Auto-implemented properties make property-declaration more concise when no additional logic is required in the property accessors. They also enable client code to create objects.
Syntactically, the following is allowed:
public string Name { get; [SomeCustomAttribute] set; }
The rest is up to (your?) SomeCustom
Attribute.
It would of course have to be a method attribute, not a property attribute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With