There are tools (eg Resharper) with capabilities to detect unused symbols (including variables) in C# code.

However, such tools can be fooled (eg by code which uses reflection) into incorrectly...