大家好,我在网上冲浪以获取自定义属性。我掌握了这个概念,但是,惊讶和困惑地看到他们通过属性类的构造函数设置属性值作为参数,它没有将任何参数作为构造函数的值。请澄清核心概念。
[DeBugInfo(45, "Zara Ali", "12/8/2012", **Message = "Return type mismatch"**)]
//like the Message here.
public class DeBugInfo : System.Attribute
{
private int bugNo;
private string developer;
private string lastReview;
public string message;
public DeBugInfo(int bg, string dev, string d)
{
this.bugNo = bg;
this.developer = dev;
this.lastReview = d;
}
public int BugNo
{
get
{
return bugNo;
}
public string Developer
{
get
{
return developer;
}
}
public string LastReview
{
get
{
return lastReview;
}
public string Message
{
get
{
return message;
}
set
{
message = value;
}
}
//////////////////////////