How can you identify anonymous methods via reflection?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Look at the attributes of the method, and see if the method is decorated with CompilerGeneratedAttribute.
Anonymous methods (as well as other objects, such as auto-implemented properties, etc) will have this attribute added.
For example, suppose you have a type for your class. The anonymous methods will be in:
This should return any anonymous methods defined on
MyClass.