Assembly.GetExportedTypes与GetTypes

Assembly.GetExportedTypes()做什么? 它与Assembly.GetTypes()有什么不同

你能用例子解释一下吗?

GetExportedTypes()不包含protected / private / internal类型。 根据以下Alexander的问题中链接的问题,即使通过InternalsVisibleToAttribute对程序集可见,也不包括内部类型。

GetTypes()包括所有类型。

GetExportedTypes()仅返回在相关程序集外部可见的类型。 “可见”表示嵌套在其他公共类型中的公共类型和公共类型。

关于InternalsVisibleToAttribute和这个问题的一点评论。

即使调用是由具有InternalsVisibleTo属性的程序集进行的, GetExportedTypes()也不会返回internal类型。

因此, GetExportedTypes()仅返回public类型。