Reputation: 6129
What are the negative implications of referencing many assemblies? I have noticed ReSharper has the ability to "Remove Unused References" (though, sometimes it's wrong, such as when assemblies that depend on a reference are loaded at runtime via Ninject), but is there any benefit besides making the project look a little cleaner? Will the resulting assembly take use less memory at runtime? Perhaps the compiler is smart enough to notice a reference is unused?
Upvotes: 3
Views: 616
Reputation: 19407
The compiler is smart enough to ignore any unused references.
However, there would be a performance impact with many assemblies referenced in Visual Studio Intellisense.
From C# Team's FAQ Blog on MSDN
Given that the .NET platform encourages binary reuse of types, it is commonplace to set references to external assemblies using the Visual Studio .NET Add Reference dialog box. Many programmers (especially those of the C(++) ilk) fear that adding unnecessary external references can result in a bit of 'code bloat'. Nothing could be further from the truth. When you add assembly references or make use of the 'using' keyword, csc.exe will ignore any assembly which you have not actually made use of in your code.
Upvotes: 6
Reputation: 15559
Every assembly reference is a dependency that increases coupling within a system. The biggest impact in my experience to having too many references is it indicates poorly enforced system design and can be indicative of a system on its way to becoming a big ball of mud.
Upvotes: 0