Assembly.GetExportedTypes vs GetTypes

后端 未结 3 1855
萌比男神i
萌比男神i 2020-12-20 11:23

What does Assembly.GetExportedTypes() do? How is it different from Assembly.GetTypes()

Can you explain with example?

相关标签:
3条回答
  • 2020-12-20 11:32

    Little remark about InternalsVisibleToAttribute and this question.

    Even if the call is made by an assembly with an InternalsVisibleTo attribute, GetExportedTypes() won't return internal types.

    So, GetExportedTypes() returns only public types.

    0 讨论(0)
  • 2020-12-20 11:43

    GetExportedTypes() does not include protected/private/internal types. As per the question linked in Alexander's question below, internal types are not included even if would be visible to an assembly via InternalsVisibleToAttribute.

    GetTypes() includes all types.

    0 讨论(0)
  • 2020-12-20 11:54

    GetExportedTypes() returns only types which are visible outside the assembly in question. "Visible" means public types and public types nested within other public types.

    0 讨论(0)
提交回复
热议问题