Use the GetCustomAttributes method of the delegate Method property. Here's a sample:
delegate void Del(); [STAThread] static void Main() { Del d = new Del(TestMethod); var v = d.Method.GetCustomAttributes(typeof(ObsoleteAttribute), false); bool hasAttribute = v.Length > 0; } [Obsolete] public static void TestMethod() { }
If the method has an attribute, var v will contain it; otherwise it will be an empty array.
Michael bray
source share