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. MethodInfo - Get summary - How can i get the methods summary from a method ?

MethodInfo - Get summary - How can i get the methods summary from a method ?

Scheduled Pinned Locked Moved C#
questiontutorial
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.
  • B Offline
    B Offline
    bonzaiholding
    wrote on last edited by
    #1

    How can i get the summary info of function by MethodInfo ? If i have inside of class A function that will look like this :

    /// <summary>
    /// This Function check if the number is bigger then 10
    /// </summary>
    /// <param name="num"></param>
    /// <returns></returns>
    public bool CheckItFunc(int num)
    {
    return num > 10;
    }

    I can get Method info by this line :

    System.Reflection.MethodInfo mi = typeof(Class A).GetMethod("CheckItFunc");

    I can get the name of the function by mi.Name for example and i can find a paramather list and more. I there any way to get the summary of a function in runtime? (in this case get the string: " This Function check if the number is bigger then 10") ?? Thanks for all of your answers.

    modified on Thursday, August 20, 2009 9:11 AM

    L 1 Reply Last reply
    0
    • B bonzaiholding

      How can i get the summary info of function by MethodInfo ? If i have inside of class A function that will look like this :

      /// <summary>
      /// This Function check if the number is bigger then 10
      /// </summary>
      /// <param name="num"></param>
      /// <returns></returns>
      public bool CheckItFunc(int num)
      {
      return num > 10;
      }

      I can get Method info by this line :

      System.Reflection.MethodInfo mi = typeof(Class A).GetMethod("CheckItFunc");

      I can get the name of the function by mi.Name for example and i can find a paramather list and more. I there any way to get the summary of a function in runtime? (in this case get the string: " This Function check if the number is bigger then 10") ?? Thanks for all of your answers.

      modified on Thursday, August 20, 2009 9:11 AM

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The structured comments aren't stored in the executable, if anywhere they are in separate XML files. so you won't get them with reflection. And they don't normally become part of the distribution either. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      B 1 Reply Last reply
      0
      • L Luc Pattyn

        The structured comments aren't stored in the executable, if anywhere they are in separate XML files. so you won't get them with reflection. And they don't normally become part of the distribution either. :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        B Offline
        B Offline
        bonzaiholding
        wrote on last edited by
        #3

        Thanks for your answer. I solved the problem in this way: 1. I create New Attribute(MyAttribute) that contain string called "MyFunctionTextHeader". 2. Every method have an MyAttribute :

        [MyAttribute("My function description)")]
        public bool MyFunc(int num)
        {
        ....
        }

        3. when i have "MethodInfo" name mi i write this line:

         string TextHeader = ((MyAttribute)mi.GetCustomAttributes(typeof(MyAttribute), false)\[0\]).MyFunctionTextHeader;
        

        and that solve my problem.

        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