Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

reflection

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?

like image 962
Efstathios Chatzikyriakidis Avatar asked May 07 '15 09:05

Efstathios Chatzikyriakidis


People also ask

What is check in C?

Learn how to check a character value in C We have access to several useful checks: isalnum() checks if a character is alphanumeric. isalpha() checks if a character is alphabetic. iscntrl() checks if a character is a control character. isdigit() checks if a character is a digit.

Is integer check in C?

The C library function int isdigit(int c) checks if the passed character is a decimal digit character. Decimal digits are (numbers) − 0 1 2 3 4 5 6 7 8 9.

How do you check if a character is a number in C?

The function isdigit() is used to check that character is a numeric character or not. This function is declared in “ctype. h” header file. It returns an integer value, if the argument is a digit otherwise, it returns zero.

How do you check if a character is an alphabet in C?

C isalpha() In C programming, isalpha() function checks whether a character is an alphabet (a to z and A-Z) or not. If a character passed to isalpha() is an alphabet, it returns a non-zero integer, if not it returns 0. The isalpha() function is defined in <ctype. h> header file.


1 Answers

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.

like image 189
avb Avatar answered Oct 28 '22 18:10

avb