Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Getting notified when a method is called

Getting notified when a method is called

Scheduled Pinned Locked Moved C#
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Rohde
    wrote on last edited by
    #1

    Hello, is there a generic way to "get informed when a method is called or left". I know I could enter code at the start and end of every method but I would prefer an automated way. Any ideas?

    A L 2 Replies Last reply
    0
    • R Robert Rohde

      Hello, is there a generic way to "get informed when a method is called or left". I know I could enter code at the start and end of every method but I would prefer an automated way. Any ideas?

      A Offline
      A Offline
      Angel Reyes
      wrote on last edited by
      #2

      I think that what you'll want to do it is to create an Event[^] that fires off when the method is called.

      R 1 Reply Last reply
      0
      • A Angel Reyes

        I think that what you'll want to do it is to create an Event[^] that fires off when the method is called.

        R Offline
        R Offline
        Robert Rohde
        wrote on last edited by
        #3

        Thats not what I want. Lets assume I want to log every action of a set of classes. I want a mechansim to make a log entry on every call to a property or method in those classes, without firing events everywhere by myself.

        1 Reply Last reply
        0
        • R Robert Rohde

          Hello, is there a generic way to "get informed when a method is called or left". I know I could enter code at the start and end of every method but I would prefer an automated way. Any ideas?

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          The only generic way to do this is implement the ICorProfilerCallback interface, provided by the runtime. That said, I have never been able to figure it out either. Search on gotdotnet for CLR Profiler 2.0, that mite provide some help as the source is available. top secret xacc-ide 0.0.1

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups