The difference between GetTypes() and GetExportedTypes() methods of the Assembly class.

  • Thread starter Abdessamad Belangour
  • Start date
A

Abdessamad Belangour

Hi all,
An assembly is composed of a set of modules. An Assembly and a Module
classes have a GetTypes() methods. Moreover, an Assembly class has a
GetExportedTypes() method.
1. This means that if i use the GetTypes() of an Assembly class there's no
need to browse its modules and call their GetTypes() methods ?
2. The GetExportedTypes() method of an Assembly class returns only types
that an external client could call; and the GetTypes() method of an Assembly
class returns even types that are not allowed to be used of an external
client?
Correct me please.
and thanks in advance.
Abdessamad.
 
N

Nicholas Paldino [.NET/C# MVP]

Abdessamad,

See inline:

Abdessamad Belangour said:
Hi all,
An assembly is composed of a set of modules. An Assembly and a Module
classes have a GetTypes() methods. Moreover, an Assembly class has a
GetExportedTypes() method.
1. This means that if i use the GetTypes() of an Assembly class there's no
need to browse its modules and call their GetTypes() methods ?

Yes, this is right, it will give you the type information for all types
in all of the modules that make up the assembly.
2. The GetExportedTypes() method of an Assembly class returns only types
that an external client could call; and the GetTypes() method of an Assembly
class returns even types that are not allowed to be used of an external
client?

Yes, this is correct as well. I don't know what the criteria are for
types to be returned, but I assume it is all public classes, as well as any
protected and protected internal classes.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top