是内部的类型从Assembly.GetExportedTypes可见的()?类型、Assembly、GetExportedTypes

2023-09-06 22:29:58 作者:指尖√微微凉

可能重复:   Assembly.GetExportedTypes VS GetTypes

是内部类型可见,当调用了 Assembly.GetExportedTypes()?如果没有,那么就被打了电话从装配与 InternalsVisibleToAttribute 改变行为?

Are internal types visible when a call is made to Assembly.GetExportedTypes()? If not, then does the call being made from an assembly with an InternalsVisibleToAttribute change the behavior?

推荐答案

GetTypes 返回程序集中的所有类型,同时 GetExportedTypes 返回类型标记为public,即:

GetTypes returns all the types in the assembly while GetExportedTypes returns only the types marked as public, i.e.:

public class A

将由这两种方法被返回

would be returned by both methods

class B

将仅由 GetExportedTypes