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?
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.
public string Name
{
get;
[SomeCustomAttribute]
set;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.