maxp
maxp

Reputation: 25141

Namespace conflicts

Ive got a project that uses the Google .NET API.

It has a root namespace of 'Google' (unsuprisingly).

Ive just created a class with the following namespace

namespace Foo.Google{    
class Bar{ }
}

Obviously this is now going to 'conflict' as Google is ambiguous (precedence is actually given to Foo.Google).

Other than just renaming Foo.Google to Foo.Goog, are then any other cleverer approaches?

Upvotes: 1

Views: 141

Answers (4)

Vman
Vman

Reputation: 3136

(If I've understood the question correctly) cant you do something like:

using GoogleApi = Google;

Upvotes: 0

Daniel Daranas
Daniel Daranas

Reputation: 22624

No, there are no cleverer approaches. Avoiding namespaces conflicts by not using the same namespaces of the third party code which you use is the way to go.

Upvotes: 2

Adriano Repetti
Adriano Repetti

Reputation: 67090

You can import the Google .NET API using an alias (check reference properties).

Upvotes: 2

Anton Gogolev
Anton Gogolev

Reputation: 115751

Try global::Google.Whatever.

Upvotes: 2

Related Questions