I have a System.Reflection.EventInfo object, and I want to know whether the event described by this object is static or not. Unlike System.Reflection.MethodInfo, EventInfo does not have IsStatic property that would tell me what I need. So, how can I do it in C#?
Also, if I have a MemberInfo object that describes some member of my class (could be property, method, field, etc.), how can I determine if this member is static or not? Is the only way to do it to cast my MemberInfo object into the needed type (into MethodInfo if this was a method, for example) and then check if this member is static?
An
Event, when declared, under the hood turns into a special method typed as adelegatewith anAddandRemovemethods.What you can do, is check the
Addmethod being generated to see if it isstatic: