Scenario: I needed to add HttpUtility to my project, and I started by adding “using System.Web” to my collection of using directives. However the HttpUtility class would still not resolve, and I discovered (via this question) that I needed to add a reference to my project.
Question: Why do I need to add a reference to this library when for most other classes a “using” directive will suffice?
usingnever suffices, you always need to add a reference to the relevant DLL that contains the class.But some libraries are referenced in your project by default – most importantly among them
mscorlib.dll. Apparently all classes you’ve used until now were in this library.