Reputation: 1034
I am working on a WCF client where i have 2 service references.Both service references have a common method names.I have GetNames() in both of my service references.Since i have to instantiate based on the condition ,I am trying to do the following:
IF Yes
Serviceclient1.GetNames name1= new Serviceclient1.GetNames();
Else
ServiceClient2.GetNames name2 =new Serviceclient1.GetNames();
But I am getting ambiguous reference even though i am referring to two different namesspaces ?
I would be glad if some one can guide me here ?
Upvotes: 0
Views: 1646
Reputation: 21245
Try aliasing your conflicting reference.
using ServiceCient2 = Namespace.Serviceclient1;
From MSDN, How to: Use the Global Namespace Alias
Upvotes: 0
Reputation: 50855
You need to do one of the following:
1) Fully qualify Serviceclient1
, as in:
var name1 = new Namespace.Serviceclient1.GetNames();
2) Add a using
statement like the following:
using SomeAlias = Namespace.Serviceclient1;
Upvotes: 1