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. Reflection Question

Reflection Question

Scheduled Pinned Locked Moved C#
questionhelptutorial
3 Posts 2 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.
  • A Offline
    A Offline
    Angel Reyes
    wrote on last edited by
    #1

    Hello everyone. I've been trying to find a way of figuring out how to know which method called another method. For now I'm using the MethodInfo MethodBase Object and passing it as a parameter to the called method but is there a better way of doing it? I know that you can find out who the calling assembly is, but how do I find out the name of the method that made the call? Thanks for any help.

    L 1 Reply Last reply
    0
    • A Angel Reyes

      Hello everyone. I've been trying to find a way of figuring out how to know which method called another method. For now I'm using the MethodInfo MethodBase Object and passing it as a parameter to the called method but is there a better way of doing it? I know that you can find out who the calling assembly is, but how do I find out the name of the method that made the call? Thanks for any help.

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

      Look at my post regarding exactly how to do this, a few posts down (i think yesterday or the day before), on how to use StackTrace. From there u can get the MethodBase just as you want it, but be warned, it will likely be much slower than passing MethodBase.Current. Anyways, I dont find anything wrong with your approach as long as you keep those ugly ones private! ;p top secret xacc-ide 0.0.1

      A 1 Reply Last reply
      0
      • L leppie

        Look at my post regarding exactly how to do this, a few posts down (i think yesterday or the day before), on how to use StackTrace. From there u can get the MethodBase just as you want it, but be warned, it will likely be much slower than passing MethodBase.Current. Anyways, I dont find anything wrong with your approach as long as you keep those ugly ones private! ;p top secret xacc-ide 0.0.1

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

        Thanks for your reply, I'll look into your suggestion. I don't see anything wrong with it either other than I'm lazy and don't want to have to create the methodbase object from each of the methods that calls that particular method, I'd rather have the called method figure it out. Again, thanks for your help.

        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