I am looking for a way to programmatically inspect a .NET (C#, VB.NET,..) source code to perform static code analysis.
I'd like to perform queries on the code such as: - list classes whose name begin by x - list all the subclasses of x - list methods which instanciate an object of class x - determine if method x contains a variable named y - list methods calling the method y - ...
What I am looking for is an API or something else allowing me to write programs able to examine a source code.
NDepend gives a SQL-like query language for querying .NET code structure.
You can use System.Reflection, that should do the trick nicely for some of the things you want. As far as getting into the IL itself, check out Mono's Cecil.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With