public static void Main()
Console.WriteLine("Hello World");
var method = typeof(Program).GetMethod("MyFn");
var first = (MyAttribute)method.GetCustomAttributes(typeof(MyAttribute), true)[0] ;
Console.WriteLine(first.ErrorMessage);
Console.WriteLine(first.ErrorMessage);
var second = (MyAttribute)method.GetCustomAttributes(typeof(MyAttribute), true)[0] ;
Console.WriteLine(second.ErrorMessage);
Console.WriteLine(first.ErrorMessage);
Console.WriteLine("Hello World");
public class MyAttribute : Attribute
public string ErrorMessage {get;set;}