Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Do unused references to external assemblies lead to code bloat?

0
Posted

Do unused references to external assemblies lead to code bloat?

0

The .NET platform promotes the binary reuse of types. It is common practice to set references to external assemblies using Visual Studio .NET’s Add Reference menu item. Many developers believe that adding unnecessary and, therefore, unused external references will result in code bloat—binary code loaded into the program even though unused. But, in fact, when assembly references are added or the using keyword is used, csc.exe—the C# compiler—ignores assemblies which are not actually used by the application. For example, if references to System.Net.dll and System.Reflection.dll were added, but were not otherwise referenced in the application, the compiler would only reference the mandatory mscorlib.dll.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123