Chris
Chris

Reputation: 3129

How to fix ambiguous reference errors?

I have a web app that allows importing of contacts from Hotmail, Yahoo and GMail. I finally have it almost completed but since I added the importing of GMail, I am getting ambiguous reference errors and I am unsure how to fix them without breaking any code.

Here is a screen shot of the errors:

Ambiguous Reference Errors

Upvotes: 0

Views: 3523

Answers (2)

sm.abdullah
sm.abdullah

Reputation: 1802

you can try something like this..

using GoogleOAuthBase = Google.GData.Client.OAuthBase;

namespace abc
{


    public class Program
    {        
           //make sure this Google.GData.Client.OAuthBase is instansiateable
           var googleBase = new GoogleOAuthBase();
     }
}
  1. you can try entire name space as well.

    var googleBase = new Google.GData.Client.OAuthBase();
    

Upvotes: 1

Patrick Hofman
Patrick Hofman

Reputation: 156938

  1. Try to use unique class names as much as possible. This will be the better solution in the end.
  2. Write the entire namespace when referencing

    OAuth.OAuthBase a = new ...;
    Google.GData.Client.OAuthBase b = new ...;
    
  3. Make an using alias for one or both:

    using n2 = OAuth;
    using      Google.GData.Client;
    
    n2.OAuthBase a = new ...; // referenced using namespace
    OAuthBase b = new ...;    // referenced through existing `using`
    

Upvotes: 3

Related Questions