I’m writing an exception logger class. My question is: what to use to mark the current method? Except it’s name, cause the code will be obfuscated, so it can’t be used.
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.
You can invent your own attribute and decorate your methods with the attribute.
Something like
[MethodName("WriteXMLData")]You can then have the logger class perform some reflection on the MemberInfo object passed to it during logging.
This is a great tutorial for defining and querying your own attributes.