1
namespace Company.Product.System
{
using System;
using System.Collections.Generic;
...

This generates compiler errors because now Visual Studio can't find System.Collections.Generic;. Is there a way to workaround this? I don't want to hear about if this is a bad idea not, this decision comes from above me and I have very little choice in the matter.

cost
  • 4,420
  • 8
  • 48
  • 80

2 Answers2

4

You have two options, put the using statement outside of the namespace

using System;
using System.Collections.Generic;

namespace Company.Product.System
{
...

Or add the global:: prefix to the namespace, this forces it to use the root instead of assuming you are wanting to use Company.Product.System.Collections

namespace Company.Product.System
{
using global::System;
using global::System.Collections.Generic;
...
Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
3

Either move your using directives outside of the namespace block or use the the global namespace alias like so:

namespace Company.System
{
    using global::System.Collections.Generic;
}
User 12345678
  • 7,714
  • 2
  • 28
  • 46