public class HelloWorldAttribute : System.Attribute
private string _someString;
public HelloWorldAttribute(string text)
public void MyAttributeMethod()
Console.WriteLine("HelloWorldAttribute says '{0}'.", _someString);
[HelloWorld("This is a test!!")]
public void MyClassMethod(string text)
Console.WriteLine("MyClassMethod says '{0}'", text);
public static void Main()
c.MyClassMethod("Main call");
.GetMethod("MyClassMethod")
.GetCustomAttributes(true)
.OfType<HelloWorldAttribute>()
c.MyClassMethod("Main call");