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 777089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:32:59+00:00 2026-05-14T19:32:59+00:00

The using keyword has three disparate meanings: type/namespace aliasing namespace import syntactic sugar for

  • 0

The using keyword has three disparate meanings:

  1. type/namespace aliasing
  2. namespace import
  3. syntactic sugar for ensuring Dispose is called

The documentation calls the first two definitions directives (which I’m guessing means they are preprocessing in nature), while the last is a statement.

Regardless of the fact that they are distinguished by their syntaxes, why would the language developers complicate the semantics of the keyword by attaching three different meanings to it? For example, (disclaimer: off the top of my head, there may certainly be better examples) why not add keywords like alias and import? Technical, theoretical, or historical reasons? Keyword quota? 😉

Contrived sample:

import System.Timers;
alias LiteTimer=System.Threading.Timer;
alias WinForms=System.Windows.Forms;

public class Sample {
  public void Action() {
    var elapsed = false;
    using(var t = new LiteTimer.Timer(_ => elapsed = true) {
      while (!elapsed) CallSomeFinickyApi();
    }
  }
}

“Using” is such a vague word.

  • 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-14T19:32:59+00:00Added an answer on May 14, 2026 at 7:32 pm

    It’s a jugdment call. I personally would have made the choice you suggest: use something like “alias” and “import”. I note that “alias” is a contextual keyword of C# and is used to declare that an extern alias is in usage in a particular file; it seems more natural to use that for declaring a type alias instead of “using”.

    The statement form of “using” was actually added rather late in the game; the designers wished to use “using” not just because it is already a keyword, but also because it emphasizes that a resource is being used in a particular region of code and is then going away. The fact that “using” already had a meaning in the directive sense was a happy accident.

    If this topic interests you, I’ve written several articles on it. Here for instance I have articles on how “fixed”, “partial” and “into” also have multiple meanings in C#:

    http://blogs.msdn.com/ericlippert/archive/tags/What_2700_s+The+Difference_3F00_/default.aspx

    Another answer also links to my article discussing how we ensure that not too many words are reserved for use by the language:

    http://ericlippert.com/2009/05/11/reserved-and-contextual-keywords/

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

Sidebar

Related Questions

I know that C# has the using keyword, but using disposes of the object
Has anyone done work to integrate tests created using QTP (keyword driven automation) with
Using the new auto keyword has degraded my code execution times. I narrowed the
If I am using the using keyword, do I still have to implement IDisposable
I recently modified a MYSQL query using the keyword RLIKE however when I ran
You can do it in .NET by using the keyword ref. Is there any
When using the 'as' keyword in C# to make a cast which fails, null
Is using the 'synchronized' keyword on methods in a Java DAO going to cause
Basically like using the out keyword. But the problem is with the out keyword,
Guids are created using the new keyword which makes me think it's a reference

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.