views:

75

answers:

1

Hi all,

In Java there are methods to go about scanning the classpath/all classes/within a package and enumerating the classes therein. e.g. spring component scanning uses something like this to scan all classes and find those with an interesting annotation.

If there any similar technique for C# and if so what are the APIs to use?

+4  A: 

The Reflection API is the way you would do this via C#.

You can use the Assembly class to look at assemblies (ie: packages). Within the assembly, you can use Assembly.GetTypes to retrieve a list of all of the classes.

The first link above demonstrates quite a few options of how this can be used.

Reed Copsey