6
他の属性のコード内に属性の存在をテストすることは可能ですか? MyTestAttribute.IsValidはRequiredAttributeをInception.Levelsを持っているかどうかを判断することが可能です...他の属性のコード内からの属性のテスト
public class Inception {
[Required]
[MyTest]
public int Levels { get; set; }
}
public class MyTestAttribute : ValidationAttribute {
public override bool IsValid(object o){
// return whether the property on which this attribute
// is applied also has the RequiredAttribute
}
}
:
を使用すると、次のクラス定義を持って言いますか?
いいです!私はないと思っていますが、それはちょうど推測です。 – zmbq