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