I am looking to write a utility for work where I can take a list of generated function names (we use a custom-code generation process) and traverse through all of the .cs files within a particular solution and determine if the function is being used. The most difficult thing preventing me from figuring this out is determining whether or not the function is within a commented line or block of code. I planned on just looping through each .cs file and using a streamreader looking for a match on the function name. Is that a good approach to start with?
NOTE: This is a utility that I am looking to write that I can use with various solution files. We have thousands of generated functions from our code-gen utility and I am looking to report on the unused functions.
I would compile the code and use a tool like NDepend on it, no reason to reinvent the wheel.
This process can be very well automated using a CQL (Code Query Language) statement.