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. Help Me......

Help Me......

Scheduled Pinned Locked Moved C#
helpquestion
3 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.
  • M Offline
    M Offline
    mihirhp
    wrote on last edited by
    #1

    Hello.... I am having following problem... I want to know in run time which method of which class is running ie. class MyClass { public string GetName() { string className = ?; string methodName = ?; return className + methodName; } } ....... Help quick.....

    O J 2 Replies Last reply
    0
    • M mihirhp

      Hello.... I am having following problem... I want to know in run time which method of which class is running ie. class MyClass { public string GetName() { string className = ?; string methodName = ?; return className + methodName; } } ....... Help quick.....

      O Offline
      O Offline
      originSH
      wrote on last edited by
      #2

      For a single threaded application: class MyClass { public string GetName() { string className = "MyClass"; string methodName = "GetName"; return className + methodName; } } :P As a note "Help Me" isn't a good post subject ... everyone is asking for help and it wouldn't be very useful to have all subjects as "Help" would it. A much better idea would be to give a descriptive title, like "Determine currently running class and method".

      1 Reply Last reply
      0
      • M mihirhp

        Hello.... I am having following problem... I want to know in run time which method of which class is running ie. class MyClass { public string GetName() { string className = ?; string methodName = ?; return className + methodName; } } ....... Help quick.....

        J Offline
        J Offline
        J a a n s
        wrote on last edited by
        #3

        Use this.. string cn = System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.Name; string mn = System.Reflection.MethodBase.GetCurrentMethod().Name;

        *jaans

        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