How can I check in C# if a property of class is used in a Visual Studio solution?

I have a C# class with various static public properties which work as keys.

Through time, this class is refactored many times and some keys are deprecated and no longer are referenced from other classes from projects in the same Visual Studio solution.

I want with reflection or some other way to check if any of these keys (properties) are used in other classes in the Visual Studio solution.

I want to write a unit test to discover if any keys are not used any more.

How I could do such thing?

Upvotes: 6

Views: 2671

Answers (1)

avb
avb

Reputation: 1558

If you are not using reflection to access your propery/class, you can use Shift + F12 or right click on the property/class/field and choose 'Find all references'.

This will open up the 'Find symbol results' window where you can see all references to your code element.

Upvotes: 1

Related Questions