Results 1 to 6 of 6

Thread: Method Name ...

  1. #1

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437

    Method Name ...

    How can I get the Name of the Method dynamically.
    For example ..

    Public Function Test() As Boolean
    '//Here I would like to get the name of this method dynamically ...
    '//I would like to avoid HardCoding Test here


    End Function

  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    VB Code:
    1. System.Reflection.MethodBase.GetCurrentMethod.GetCurrentMethod.Name

  3. #3

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Many Tx.

  4. #4

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Is it somehow possible to get the parameter info and/or return type of the method too ???

  5. #5

    Thread Starter
    Hyperactive Member spoiledkid's Avatar
    Join Date
    Oct 2002
    Location
    Canada
    Posts
    437
    Got it Already ..

    ParameterInfo method instead of Name property ..

  6. #6
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780
    Yer, its all in there:


    System.Reflection.MethodBase.GetCurrentMethod.GetParameters(0).ParameterType.ToString

    just look up

    System.Reflection.MethodBase.GetCurrentMethod

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width