Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 533935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:33:35+00:00 2026-05-13T09:33:35+00:00

Right, I’ve usually used ‘using’ directives as follows using System; using System.Collections.Generic; using System.Linq;

  • 0

Right, I’ve usually used ‘using’ directives as follows

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

namespace AwesomeLib
{
  //awesome award winning class declarations making use of Linq
}

i’ve recently seen examples of such as

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

namespace AwesomeLib
{
  //awesome award winning class declarations making use of Linq

  namespace DataLibrary
  {
    using System.Data;

    //Data access layers and whatnot
  }

}

Granted, i understand that i can put USING inside of my namespace declaration. Such a thing makes sense to me if your namespaces are in the same root (they organized).

System;
namespace 1 {}
namespace 2 
{
  System.data;
}

But what of nested namespaces? Personally, I would leave all USING declarations at the top where you can find them easily. Instead, it looks like they’re being spread all over the source file.

Is there benefit to the USING directives being used this way in nested namespaces? Such as memory management or the JIT compiler?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:33:36+00:00Added an answer on May 13, 2026 at 9:33 am

    IL Code does Not reflect C# using

    Runtime Performance

    Is there benefit to the USING
    directives being used this way in
    nested namespaces? Such as memory
    management or the JIT compiler?

    Because you’re asking about runtime performance, here’s a look into what’s happening underneath the source code.

    If you look at the compiled IL code with Microsoft’s IL Diassembler tool (as we’re doing here) you will see all class names are fully qualified all the time no matter how the programmer used using in the source code.

    In the following sample of compiled IL code notice no “shortcut” mechanism is seen although using was in the original C# source code files. For example IL describes one long extends [System.Web]System.Web.UI.Page whereas C# would have used : Page and also using System.Web.UI; (two separate statements).

    // ***** Compiled MSIL CODE ****
    // Notice all fully qualified classes throughout.
    // 
    
    .class public auto ansi beforefieldinit WebApplication1.process
           extends [System.Web]System.Web.UI.Page
    {
      .field family class [System.Web]System.Web.UI.HtmlControls.HtmlForm form1
      .method family hidebysig instance void 
              Page_Load(object sender,
                        class [mscorlib]System.EventArgs e) cil managed
      {
        // Code size       95 (0x5f)
        .maxstack  4
        .locals init ([0] string strName,
                 [1] string strTime)
        IL_0000:  nop
        IL_0001:  ldarg.0
        IL_0002:  call       instance class [System.Web]System.Web.HttpRequest [System.Web]System.Web.UI.Page::get_Request()
        IL_0007:  ldstr      "name"
        IL_000c:  callvirt   instance string [System.Web]System.Web.HttpRequest::get_Item(string)
    

    In the compiled IL all classes are fully qualified regardless.

    This means there are no performance benefits or drawbacks at runtime based on the design time using statements.

    Compile Time

    Depending on how you scatter about your usings and namespaces in the source code, there might be more or less of the keywords hanging around. The compiler has to see them all and process them all but overall the compile performance would be negligible for something this trivial, compared to all things a compiler has to do to make the finished product.

    Design Time Benefits

    namespaces are an organizational technique and using is a way of managing them at the source code level (and to instruct the compiler how you’re using them so it can compile the program accordingly). When C# source specifies using System.Web.UI;, nothing is imported and the file size doesn’t grow larger (because the assembly is already referenced in); instead using is simply effecting a shorter syntax to the contents of that namespace, from within the scope the using is used in, whether that be in the entire file scope or a declared namespace scope inside the file.

    The benefit to the programmer is reduction of ambiguous class name conflicts between multiple namespace usings if they are judiciously used.

    Organization of source code namespaces is represented differently in the compiled IL code (as seen in the above example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 415k
  • Answers 415k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I never heard the term "icon embedding" before. If you… May 15, 2026 at 8:52 am
  • Editorial Team
    Editorial Team added an answer 2) With jquery, listen for the change event on the… May 15, 2026 at 8:52 am
  • Editorial Team
    Editorial Team added an answer $("#selectId > option").each(function() { alert(this.text + ' ' + this.value);… May 15, 2026 at 8:52 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.