How to hook-up to a classes member functions?

  • Thread starter Thread starter Axel Dahmen
  • Start date Start date
A

Axel Dahmen

Hi,

instead of writing logging functions at the beginning and end of each of a
class's member functions, I'd like to create an attribute to somehow "hook"
into each member function call to log that call.

I can't find any information on how to hook into a class's member function
calls. How can I do this?

TIA,
Axel Dahmen
 
Axel,

What you want is method interception, which is a subset of Aspect
Oriented Programming. It isn't something that is supported in .NET.

You can get method interception though with ContextBoundObjects, but it
definitely comes at an overhead, and is not for the faint-of-heart.
 
Back
Top