2
如何訪問屬性類內的屬性值。我在寫一個自定義驗證屬性,需要根據正則表達式檢查屬性的值。該 比如:使用屬性訪問屬性值
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;}
}