title: c# passing a web service reference as a parameter in a method
body: <p>I've searched a lot for this but I always get results for passing parameters <strong>to</strong> a web service. I want to pass a web service object as a parameter into a method if this is possible. My current code is below.</p>
  
  <pre><code>    public static string CheckDaysLeft(string serial)
      {
          amazonaws.WebService1 MyService = new amazonaws.WebService1();
          return MyService.GetDaysLeft(serial).ToString();
      }
  </code></pre>
  
  <p>So I have two web services references in my project, <strong>localserver</strong> and the above <strong>amazonaws</strong>. Above I am calling this method which contacts the amazon web service and gets the days left for a particular serial number. This is working fine. I want to be able to pass as a parameter into the CheckDaysLeft method which of the two web services to use (localserver or amazonaws). The reason being that if one web service is down, the program will attempt to communicate with the other. I could create the CheckDaysLeft method twice and use the each web service reference in each method but that is not ideal.</p>
  
  <p>How can I do this?</p>