Question: One thing I do not get with [C#'s `using` Directive](https://msdn.microsoft.com/en-us/library/sf0df423.aspx) is why I can only "use" a namespace at file level, and not within any arbitrary block scope.

(`using namespace x;` of C++ does allow this and certainly the C# designers where aware of this.)

If I have, e.g., one single function in my class that does something with file I/O, it seems to me it would make sense to just write:

```
void MunchFile(string name) {
  using System.IO; // not allowed
  ...
}

```

but instead I have to write:

```
// somewhere at the top of the file:
using System.IO;
... 2 pages down ...
    void MunchFile(string name) {
      ...
    }

```

It's an irritation every time I encounter it and I keep scratching my head why this was not allowed / implemented.

So:

* Are there any statements by C# designers wrt. this?
* Is there any conceptual language design issue wrt. this?

Answer: 
**Because, the proposed feature is *a little silly.***

Namespaces exist specifically to avoid naming conflicts. The `using` exists to DRY your code. It allows the omission of namespace prefixes for items therein that don't actually conflict with anything.

That said, if there is *no* name conflict at the top level, you can put the namespace at the top. There's no reason *not* to simply put it at the top! And then the whole file is a little DRY-er.

In the usual cases, if there *is* a conflict, adding a namespace to a nested scope doesn't eliminate the conflict.

```
using Collections.Or.Something;

public void UseAMagicalListForSomething()
{
    using My.Own.Magical.Collections;
    var myMagicalList = new List<OfWhatever>(); // STILL ambiguous.
}

```

You would still need to use the fully qualified class name:

```
using Collections.Or.Something;

public void UseAMagicalListForSomething()
{
    // lengthy, but unambiguous.
    var myMagicalList = My.Own.Magical.Collections.List<OfWhatever>();
}

```

**Or** specify an alias, which you can easily do at the top:

```
using Collections.Or.Something;
using magic = My.Own.Magical.Collections;

public void UseAMagicalListForSomething()
{
    var myMagicalList = magic.List<OfWhatever>(); // unambiguous.
}

```

---

The single case where the proposed feature could resolve a naming conflict *and* successfully DRY your code, would be if you happen to have two non-overlapping blocks of code in the same file.

However, if those non-overlapping blocks of code are using entirely different namespaces, I'd take a step back and question whether they really belong in the same file. If they *really* do, I'd argue that it's better to make the relationship between those blocks and the global scope clear with namespace aliases.
There are a few reasons it may not have been allowed in C#.

1. It makes it easier to see what namespaces are being used if they are all in a centralized area.
2. It is much easier to declare the using in one location if you want to use it in multiple methods.
3. Pretty much every IDE I have worked with and VS in particular will tell you the fully qualified name of a type if you hover the cursor over it. Therefore even if it is two pages of code down from the using statement the name is allows easy to discover quickly.
4. The using statement can already appear in methods to help assist with object disposal (ex. closing file streams) so it being context sensitive to that case may prevent it from even being possible to implement now.