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?
I asked Eric Lippert the same question on his blog a few years ago here (see the first comment).
His response was:
For those who don’t know who Eric is, he’s a developer for the C# compiler team.