WishToBePro
WishToBePro

Reputation: 183

Unused References in c# application

I develop WinForms applications. How can I understand which references that I have added to my application are in use, and which ones are unused?

If I don't remove unused references, will they degrade my application performance?

Upvotes: 3

Views: 1130

Answers (3)

Wacky
Wacky

Reputation: 479

You can use extensions for VS. You can find them in VS Gallery. You can try this one: Reference Assistant

Upvotes: 0

Shadow Wizard
Shadow Wizard

Reputation: 66389

One way to see if reference is used by your code (without external tools) is to simply remove that reference and compile.

Used in the code? You'll get nice error message, just add it back.

Not used? Compile succeed and you can leave it removed.

If the reference is to your own project in the same Solution and there are few classes only, you can right click each class in Visual Studio and choose Find All References - if something is referencing that class you'll see it.

Upvotes: 1

Filip Ekberg
Filip Ekberg

Reputation: 36287

Unused references will not cause any performance loss when you run your application. Your references are used at compile time to look up unknown symbols.

It is just extra information given to your compiler; telling it where to look for symbols. When the compilation is over, it is no longer needed.

Upvotes: 12

Related Questions