seWhen i creating a new class file i got these namespaces by default,
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
But i dont use linq,Html controls,Webcontrols,Configuration,security…
- Why are they included by default?
- What will happen if i exclude these from my class file?
- What will happen if i include these without using them?
Visual Studio adds a list of common includes to any class file that you create. Since it is an ASP.Net project, this is the list of using statement added to your file. For WinForms projects, it is a different set of usings.
If you don’t use any classes within these namespaces within your file, excluding them will have no effect. If you use a class within those namespaces, you will have a compile error.
Maybe it will take a few milliseconds longer to compile that file but I’m not even sure.