C# 以编程方式检索函数头信息

C# 以编程方式检索函数头信息,c#,C#,我有一个函数GetMainWindowAE,它包含如下所示的标题信息 /// <summary> /// Gets the main window automation element. /// </summary> /// <returns></returns> public static AutomationElement GetMainWindowAE() { //Return

我有一个函数GetMainWindowAE,它包含如下所示的标题信息

    /// <summary>
    /// Gets the main window automation element.
    /// </summary>
    /// <returns></returns>
    public static AutomationElement GetMainWindowAE()
    {
        //Return automation element using window handle of that process
        return AutomationElement.FromHandle(AppContext.ActiveApplication.Process.MainWindowHandle);
    }
//
///获取主窗口自动化元素。
/// 
/// 
公共静态自动元素GetMainWindowAE()
{
//使用该进程的窗口句柄返回自动化元素
返回AutomationElement.FromHandle(AppContext.ActiveApplication.Process.MainWindowHandle);
}

如何使用.net以编程方式获取包含注释的标题中的数据?

您可以使用反射来实现这一点。方法的MethodInfo属性包含与方法关联的XML注释(也称为标题信息)

有关更多信息和代码示例,请参见