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

  • Home
  • SEARCH
  • 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 4061598
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:29:22+00:00 2026-05-20T15:29:22+00:00

More a question out of curiosity than anything, but why does C# define two

  • 0

More a question out of curiosity than anything, but why does C# define two different “purposes” for the keyword using? On one hand, it’s a directive…

used to create an alias for a
namespace or to import types defined
in other namespaces.

On the other, it’s a statement which…

defines a scope, outside of which an
object or objects will be disposed.

To me, it seems like different uses for the same keyword, but maybe I’m missing something. Is there a reason why this keyword takes on two different purposes? Or, are both of these purposes, deep down in the belly of the compiler, really the same thing?

  • 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-20T15:29:22+00:00Added an answer on May 20, 2026 at 3:29 pm

    I asked Eric Lippert the same question on his blog a few years ago here (see the first comment).

    His response was:

    This is a tricky point of language
    design; when one keyword is used to
    represent two completely different
    concepts, it can be confusing. But
    introducing a new keyword per concept
    makes the language feel a bit bloated.
    I personally would have chosen
    “imports” or some such syntax for the
    directive form to ensure that it is
    not confused with the statement form,
    but I understand that its a judgment
    call.

    We were designing a feature for C# 4.0
    that got cut which was yet another
    form of “partial” class; basically, a
    way to share attribute metadata
    between the machine-generated and
    user-generated halves of a partial
    class. I pushed back on using the
    keyword “partial” for the feature
    because we would then have had THREE
    subtly different meanings for
    “partial” in C#, which I felt was two
    too many. (I was advocating adding
    another conditional keyword
    “existing”. Unfortunately the point
    ended up moot since the feature was
    cut for lack of time.) — Eric

    For those who don’t know who Eric is, he’s a developer for the C# compiler team.

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

Sidebar

Related Questions

My question seems easy but is little more theoretical than it looks. There are
Here is one more newbie question: require 'tasks/rails' I saw this line in Rakefile
I asked a related question about findbugs, but let's ask a more general question.
EDIT: This question is more about language engineering than C++ itself. I used C++
This is kind of a weird question and more of an annoyance than technical
This is more of an generic XML Schema question, but if and how do
Really my question has more to do with the server-side scrubbing of html that's
I'm iterating through a HashMap (see my earlier question for more detail) and building
More detail to my question: HTML and JavaScript are called client-side code. C# and
On a more abstract level then a previous question , in my experience there

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.