如何访问属性类中的属性值。我正在编写一个自定义验证属性,该属性需要根据正则表达式检查属性的值。例如:
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;}
}