我正在尝试移植一个使用反射的现有C#类(通用工厂),但是我无法使这段代码编译:
Type[] types = Assembly.GetAssembly(typeof(TProduct)).GetTypes();
foreach (Type type in types)
{
if (!typeof(TProduct).IsAssignableFrom(type) || type == typeof(TProduct))
...
我尝试查看了.NET框架中的反射和程序集类,在其中发现了一个例子,由于"using System.Security.Permissions"而无法编译。