Define a attribute for remark : AttributeUsage « Attribute « C# / CSharp Tutorial






using System;

[AttributeUsage(AttributeTargets.All)] 
public class MyAttribute : Attribute { 
  string remark;
 
  public MyAttribute(string comment) { 
    remark = comment; 
  } 
 
  public string Remark { 
    get { 
      return remark; 
    } 
  } 
}








10.6.AttributeUsage
10.6.1.AttributeUsage
10.6.2.Define a attribute for remark