我正在使用Reflection.Emit生成一个动态程序集,一切都正常,但由于以下代码,生成的类被标记为internal sealed
:
var typeBuilder = moduleBuilder.DefineType("MyNamespace.Program", TypeAttributes.Class | TypeAttributes.Sealed);
我没有看到任何 TypeAttributes
成员提示 static
。它似乎不仅仅是编译器的方便,因为我可以在反射工具中手动编写类,并将其显示为 static
。
我该如何将自己的类型标记为静态?