Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Too many namespaces in a class

Too many namespaces in a class

Scheduled Pinned Locked Moved C#
performancequestion
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Abhinav S
    wrote on last edited by
    #1

    If we have many unused namespaces in a class, does it affect performance in any way?

    M J L P 4 Replies Last reply
    0
    • A Abhinav S

      If we have many unused namespaces in a class, does it affect performance in any way?

      M Offline
      M Offline
      Migounette
      wrote on last edited by
      #2

      In visual studio you can: Main Menu - On the Edit menu, point to IntelliSense, point to Organize Usings, and then click Remove Unused Usings. Context Menu - Right-click anywhere inside the code editor, point to Organize Usings, and then click Remove Unused Usings. My feeling is that, it will be removed during compilation time (JIT) so the performance will be impacted during the load of the file, evaluation of it. But not during the runtime.

      1 Reply Last reply
      0
      • A Abhinav S

        If we have many unused namespaces in a class, does it affect performance in any way?

        J Offline
        J Offline
        jdkulkarni
        wrote on last edited by
        #3

        Nope. But if you add extra unused references then yes. Please refer http://msdn.microsoft.com/en-us/magazine/cc163655.aspx[^]

        Jayant D. Kulkarni Brainbench Certified Software Engineer in C#1.1, C# 2.0, ASP.NET, .NET Framework and ADO.NET

        P 1 Reply Last reply
        0
        • A Abhinav S

          If we have many unused namespaces in a class, does it affect performance in any way?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Only during the compile phase when the compiler builds its internal reference tables. The final object code should not be affected.

          1 Reply Last reply
          0
          • J jdkulkarni

            Nope. But if you add extra unused references then yes. Please refer http://msdn.microsoft.com/en-us/magazine/cc163655.aspx[^]

            Jayant D. Kulkarni Brainbench Certified Software Engineer in C#1.1, C# 2.0, ASP.NET, .NET Framework and ADO.NET

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #5

            jdkulkarni wrote:

            if you add extra unused references then yes

            They may affect compile time, but not run time.

            1 Reply Last reply
            0
            • A Abhinav S

              If we have many unused namespaces in a class, does it affect performance in any way?

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              That question makes no sense. 0) Namespaces aren't in classes. 1) If it's unused, it's not in the class.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups