0
클래스를 확장 할 때 속성 값을 '변경'할 수 있습니까? 다음과 비슷한 무언가가 :클래스를 확장 할 때 속성의 속성 값을 확장/변경
public class Mammal
{
[Validation(Required=true, HelpMessage="This is the body shape of a mammal")]
public virtual string BodyShape { get; set; }
}
public class Dog : Mammal
{
[Validation(HelpMessage = "This is the body shape of a dog")]
public override string BodyShape
{
get
{
return base.BodyShape;
}
set
{
base.BodyShape = value;
}
}
}
내가 Dog.BodyShape의 속성을 읽을 수, 트루 필수 = 및 HelpMessage =로 좀하고 싶습니다
"이것은 강아지의 몸 모양이다." 이것이 가능한가? 그렇지 않다면, 컴파일러에서 직접 속성에 '메타 데이터'정보를 추가 할 수있는 대체 제안이 있습니까?
특성은 AttributeUsage.Inherited 속성 값에 따라 상속됩니다 (http://msdn.microsoft.com/en-us/library/tw5zxet9(v=vs.110).aspx) – dugas