C# class scanning
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 somet开发者_StackOverflowhing 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?
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.
精彩评论