M
Mark Rae
Hi,
Looking for opinions again...
When creating a new WinForm or WebForm in C#, the .cs code-behind file is
created automatically with some default interfaces at the top, e.g. in the
case of a WebForm,
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
That's fine, of course, but I'm interested to know if there is any benefit
in removing those interfaces which will not be required by any subsequent
code on the page. E.g. if the form doesn't need to interface with a
database, there's no need for System.Data to be referenced. Similarly, if
you're not working with ArrayLists or HashTables, you can safely remove
System.Collections.
Is this worth doing? Does each reference to an interface consume server
resources even if it isn't used? Do developers delete the unused references
or just leave them? Does it matter?
Mark
Looking for opinions again...

When creating a new WinForm or WebForm in C#, the .cs code-behind file is
created automatically with some default interfaces at the top, e.g. in the
case of a WebForm,
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
That's fine, of course, but I'm interested to know if there is any benefit
in removing those interfaces which will not be required by any subsequent
code on the page. E.g. if the form doesn't need to interface with a
database, there's no need for System.Data to be referenced. Similarly, if
you're not working with ArrayLists or HashTables, you can safely remove
System.Collections.
Is this worth doing? Does each reference to an interface consume server
resources even if it isn't used? Do developers delete the unused references
or just leave them? Does it matter?
Mark