2

Several namespaces are automatically used when a class file is created by Visual Studio:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

Some of them are used in code, but some seems are not. Is it good practice to delete the ones which are not used?

Feedfedfat
  • 173
  • 1
  • 13
  • It will speed up your build time. Other than that, in the generated dlls, those stuff got removed by the compiler. – DPac Sep 23 '15 at 02:32
  • Here is a link from programmers stackexchange http://programmers.stackexchange.com/questions/126996/what-are-the-consequences-of-having-unnecessary-references-and-usings – DPac Sep 23 '15 at 02:34
  • http://stackoverflow.com/questions/12026820/do-unused-usings-in-net-affect-performance – displayName Sep 23 '15 at 03:25
  • _"It will speed up your build time"_ - I don't believe there is sufficient evidence for that mentioned in the links you provided –  Sep 23 '15 at 04:31
  • You might check this question for some discussion of this: http://stackoverflow.com/questions/6774624/does-using-namespaces-affect-performance-or-compile-time. As is said there, it cannot affect runtime performance. If you look at generated IL code, you'll see that it always uses full type name. The `using` statements only help keep you code cleaner, but the compiler effectively removes them. – vesan Sep 23 '15 at 06:42

0 Answers0