0

i have seen many C# programs that imports unused namespaces is that a bad habbit.is that kind of namespaces reduces the efficiency of program. eg:

using System;
using System.Collections.Generic;//unused namespace
using System.Linq;//unused namespace
using System.Text;//unused namespace

namespace ConsoleApplication14
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
            Console.ReadKey();
        }
    }
}
user2864740
  • 60,010
  • 15
  • 145
  • 220
Shamseer K
  • 4,964
  • 2
  • 25
  • 43

1 Answers1

1

No, there isn't any problem. You can have unused namespaces, there're not going to be causing any efficiency problems. The only impact it has, is the IDE and compiling process, compiler would look into all files and so on. But the processes are only executed for the code you've written.

However, if you're still trying to get rid of them, read this on MSDN, they're having a method to get rid of them. http://msdn.microsoft.com/en-us/library/7sfxafba(v=vs.80).aspx

Afzaal Ahmad Zeeshan
  • 15,669
  • 12
  • 55
  • 103