属性クラス内のプロパティの値にアクセスするにはどうすればよいですか? プロパティの値を正規表現と照合する必要があるカスタム検証属性を作成しています。たとえば、次のようになります。
public class MyAttribute
{
public MyAttribute (){}
//now this is where i want to use the value of the property using the attribute. The attribute can be use in different classed
public string DoSomething()
{
//do something with the property value
}
}
Public class MyClass
{
[MyAttribute]
public string Name {get; set;}
}