本文整理匯總了C#中System.Reflection.Assembly.GetExportedTypes方法的典型用法代碼示例。如果您正苦於以下問題:C# Assembly.GetExportedTypes方法的具體用法?C# Assembly.GetExportedTypes怎麽用?C# Assembly.GetExportedTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Reflection.Assembly
的用法示例。
在下文中一共展示了Assembly.GetExportedTypes方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Main
//引入命名空間
using System;
using System.Reflection;
public class Example
{
public static void Main()
{
foreach (Type t in typeof(Example).Assembly.GetExportedTypes())
{
Console.WriteLine(t);
}
}
}
public class PublicClass
{
public class PublicNestedClass {}
protected class ProtectedNestedClass {}
internal class FriendNestedClass {}
private class PrivateNestedClass {}
}
internal class FriendClass
{
public class PublicNestedClass {}
protected class ProtectedNestedClass {}
internal class FriendNestedClass {}
private class PrivateNestedClass {}
}
示例2: Main
//引入命名空間
using System;
using System.Reflection;
public class MainClass
{
static void Main(string[] args)
{
Assembly XMLAssembly;
Type[] XMLTypes;
XMLAssembly = Assembly.Load("System.Xml, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
XMLTypes = XMLAssembly.GetExportedTypes();
foreach(Type XMLType in XMLTypes)
{
object NewObject;
Console.Write(XMLType.ToString());
NewObject = XMLAssembly.CreateInstance(XMLType.ToString());
if(NewObject != null)
Console.WriteLine(" - Creation successful");
else
Console.WriteLine(" - CREATION ERROR");
}
}
}