I am trying to find out all the classes and assemblies which are using/referencing a particular class. Is there any way to find out through programming in C#?
For example, if Class1 is called/referenced by Class2 in Assembly1, Class3 in Assembly2, I want to find Class2 & Class3 using C# programming.
Is there anyone who could help me? Is there any tool that could help in this? I want to write a small program to read class from one assembly and find the classes where that particular class is referenced/used.
My question in short: How to find unused class or method in my codebase by writing a C# program as a part of code cleanup activity?
If you're looking for a tool to do this, you could use NDepend which can do what you're describing and also a lot more.
Or, if you're using ReSharper: Right-Click, "find usages"... (not useful for finding unused code indeed)
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