[Mono-dev] Can we change the name of the MonoTests.System namespace?

Jonathan Pryor jonpryor at vt.edu
Wed Jan 9 09:30:06 EST 2008

On Wed, 2008-01-09 at 01:53 -0800, Dean Brettle wrote:
> This has happened several times now.  I'm adding some code to a unit
> test class and want to use the fully qualified name (e.g.
> System.Web.UI.Adapters.PageAdapter) for some type, either because (a)
> I'm only using the type in a couple spots and I'd rather not pollute
> the namespace with a 'using' declaration, or (b) the unqualified name
> (e.g. PageAdapter) is already being used in the current namespace for
> something else.
> But when I try to use the fully qualified name I get a compile time
> error like this:
> error CS0234: The type or namespace name `PageAdapter' does not exist
> in the namespace `MonoTests.System.Web.UI.Adapters'. Are you missing
> an assembly reference?

Use global::System.Web.UI.Adapters.PageAdapter.

Your alternate solution of renaming MonoTests.System to MonoTests_System
or some other variant would also work, but we have LOTS of unit tests
already using MonoTests.System, and they won't all be changed at once.
So we'd have a lengthy migration period, increasing confusion.

So the simpler solutions are to:
  - Just pollute the global namespace with using declarations.  (It's a 
    unit test, why worry about namespace pollution?)
  - Use a using alias just for the conflicting types
  - Use global:: when the above two don't work.

 - Jon

More information about the Mono-devel-list mailing list