accessing local varibales in a method

Avik Sengupta's Avatar

Avik Sengupta

26 Feb, 2014 09:21 AM

I am evaluating post sharp for a project work and have a problem to solve.
I want to use MethodBoundaryAspect to perform some custom logging activity. The logging method returns a string that I need to pass on to a variable declared in the actual method body. Can this be achieved any way?

Thanks!
Avik

  1. Support Staff 1 Posted by PostSharp Techn... on 26 Feb, 2014 01:18 PM

    PostSharp Technologies's Avatar

    Hello Avik,

    It's not possible to access the local variables declared inside the method body. What's possible is setting the value of the method argument using MethodExecutionArgs.Arguments or accessing the current object instance using MethodExecutionArgs.Instance and setting the field/property.

    -alex

  2. System closed this discussion on 13 Apr, 2016 10:33 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac