views:

65

answers:

3

If we imports more namespace in the code file(cs file) then it affects on perfomance ? Like we should add namespace in the cs file as needed. That is adding more namespace in the cs file affects performance ? Like

using System;
using System.Data.Sql;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
using System.Data.SqlClient;
using System.ComponentModel;
A: 

No it will not affect performace. As it is only used by the Compiler.

anantmf
+2  A: 

It doesn't affect your perfomance at all.

Everything is loaded when it's needed. So if you have some statements that are never used, it won't hurt the performance of your application.

Unused statements are mostly cleaned up for clarity and readability of code.

Shaharyar
A: 

It doesn't affect performance. But for code cleanliness, I would suggest removing using statements that are not needed in a particular class file. It's simple enough, just right-click within the IDE and go to Organize Usings.

Anthony Pegram