2010-10-08 43 views
1

我有一個函數Ge​​tMainWindowAE,它包含如下所示的頭信息。以編程方式檢索函數頭信息

/// <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); 
    } 

我該如何以編程方式獲取標題中使用.net標註的數據?

回答

0

您可以使用反射來實現此目的。該方法的MethodInfo屬性包含與該方法(AKA頭信息)相關聯的XML註釋。

有關更多信息和代碼示例,請參閱this blog entry