Oh hi Mark
Oh hi Mark

Reputation: 213

How to deal with different namespaces?

I have a list of type A.Composite and I add a service reference named ServiceA. ServiceA has a Composite class, the same as A.Composite.

My issue is that I cannot add the ServiceA.composite object to the list because of the difference in the namespace. The first is A.Composite and the second A.ServiceA.Composite.

How can I deal with this problem?

Upvotes: 0

Views: 85

Answers (2)

Patrick Hofman
Patrick Hofman

Reputation: 157136

ServiceA has a Composite class, the same as A.Composite.

If the two classes are the exact same (it is just an object returned from the service, picked up in the client in the exact same code), you should include the assembly containing it in your service.

You can read more about it here. It explains how to reuse types shared between server and client.

Upvotes: 2

Rahul Tripathi
Rahul Tripathi

Reputation: 172628

You can create an alias name as global::Foo. So at the top of your source file, just after you using statements, add like this

using AliasClass1=global::Foo.Class1;

Upvotes: 0

Related Questions