【发布时间】:2014-03-11 02:28:11
【问题描述】:
有没有办法用属性覆盖自动属性的 setter 和 getter?
像这样:
[CustomAttribute]
public int Value { get; set; }
...
public class CustomAttibute : Attribute
{
public override NotExistingPropertySetter(object value)
{
if (((int)value) < 10 )
{
value = 10;
}
}
}
【问题讨论】:
标签: c# .net properties attributes custom-attributes