一個應用程序,我想開發如Visual Studio對象瀏覽器的應用程序,即用戶將輸入類似System.Text
命名空間或系統類。點擊按鈕後,我們必須找出「System.Text」中的所有類,函數,屬性等。創建如Visual Studio對象瀏覽器
我嘗試以下,但失敗了。
Assembly SampleAssembly;
SampleAssembly = Assembly.Load("System.Text");
Type[] Types = SampleAssembly.GetTypes();
// Display all the types contained in the specified assembly.
StringBuilder str = new StringBuilder();
foreach (Type oType in Types)
{
str.Append(oType.Name.ToString() + "</br>");
}
divAsseblyData.InnerHtml = str.ToString();
您是否遇到異常? –
是的,得到錯誤FileNotFound異常?第2行:SampleAssembly = Assembly.Load(「System.Text」); – Justinonday
沒有像'System.Text'程序集這樣的東西;它只是mscorlib.dll中的一個命名空間。重寫代碼以加載mscorlib,然後導航到System.Text命名空間。 –