title: The best overloaded method match for has some invalid arguments
body: <p>I am using VS 2010 C#.  My code is as follows:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Threading;
  using MarketplaceWebServiceOrders;
  using MarketplaceWebServiceOrders.Model;
  
  namespace FetchNewOrdersJob
  {
      public class MarketplaceWebServiceOrders
      {
          private volatile bool isRunning;
          private OrderFetcher orderFetcher;
  
          private TimeSpan _checkOrdersInterval = TimeSpan.FromMinutes(15.0);
          /// &lt;summary&gt;
          /// Gets or sets the order check interval.  Defaults to 15 minutes.
          /// &lt;/summary&gt;
          public TimeSpan CheckOrdersInterval
          {
              get { return _checkOrdersInterval; }
              set { _checkOrdersInterval = value; }
          }
  
          /// &lt;summary&gt;
          /// Internal method to handle an order.
          /// &lt;/summary&gt;
          protected virtual void HandleOrder(Order order)
          {
              Console.WriteLine("Processing Order:");
              Console.WriteLine("---------------------------------------------------");
              Console.WriteLine(order.ToString());
              // Fetch the order items in each order
              orderFetcher.FetchOrderItems(order.AmazonOrderId, delegate(OrderItem item)
              {
                  Console.WriteLine("\tProcessing Order Item");
                  Console.WriteLine("\t---------------------------------------------------");                // Process order item here.
                  Console.WriteLine("\t" + item.ToString().Replace("\n", "\n\t"));
              });
  
              Console.WriteLine("=================================================");
              Console.WriteLine();
          }
  
          /// &lt;summary&gt;
          /// Method to continuously check orders over an interval, and list OrderItems for those Orders.
          /// &lt;/summary&gt;
          private void OrdersJobThread(object obj)
          {
              orderFetcher.ProcessOrder += HandleOrder;
  
              if (this.CheckOrdersInterval == TimeSpan.MinValue)
              {
                  throw new ArgumentException("The CheckOrdersInterval TimeSpan cannot be zero.", "CheckOrdersInterval");
              }
  
              DateTime startCheckInterval = DateTime.Now.Subtract(CheckOrdersInterval);
  
              // Continue forever until the isRunning flag is cleared.
              while (isRunning)
              {
                  try
                  {
                      // Check the orders for this interval.
                      DateTime checkInterval = startCheckInterval;
                      startCheckInterval = DateTime.Now.Subtract(TimeSpan.FromMinutes(3.0));
  
                      Console.WriteLine("Fetching orders from " + checkInterval.ToString() + " to " + startCheckInterval.ToString());
                      orderFetcher.FetchOrders(checkInterval, startCheckInterval);
  
                      // Wait for the next interval.
                      Console.WriteLine("Fetch complete.  Sleeping until next interval.");
                      while (isRunning &amp;&amp; DateTime.Now.Subtract(startCheckInterval) &lt; CheckOrdersInterval)
                      {
                          Thread.Sleep(1000);
                      }
                  }
                  catch(Exception err)
                  {
                      Console.WriteLine("Error: " + err.Message + ".  Orders job thread is exiting.");
                      isRunning = false;
                  }
              }
          }
  
          /// &lt;summary&gt;
          /// Sample code to invoke the OrderFetcher.
          /// &lt;/summary&gt;
          /// &lt;param name="service"&gt;MarketplaceWebServiceOrders object.&lt;/param&gt;
          /// &lt;param name="sellerId"&gt;The seller Id.&lt;/param&gt;
          /// &lt;param name="marketplaceIdList"&gt;List of marketplaces passed in to the GetOrders call.&lt;/param&gt;
          public static void InvokeOrderFetcherSample(
              MarketplaceWebServiceOrders service,
              string sellerId,
              string [] marketplaceIdList
          )
          {
              // Create a FetchOrderUpdates job with the default time span.
              MarketplaceWebServiceOrders job = new MarketplaceWebServiceOrders();
              job.isRunning = true;
              job.orderFetcher = new OrderFetcher(service, sellerId, marketplaceIdList);
  
              Thread jobThread = new Thread(job.OrdersJobThread);
              jobThread.IsBackground = true;
              jobThread.Start();
  
              // Pause on the main thread for one hour or until the thread exits, then end the job.
              jobThread.Join(1000 * 60 * 60);
              job.isRunning = false;
  
              // Block until the thread terminates to prevent any requests in progress from being aborted.
              while (jobThread.IsAlive)
              {
                  Thread.Sleep(1000);
              }
          }
      }
  }
  </code></pre>
  
  <p>I get two errors and can't seem to figure this out</p>
  
  <ol>
  <li><p>Argument 1: cannot convert from 'FetchNewOrdersJob.MarketplaceWebServiceOrders' to 'MarketplaceWebServiceOrders.MarketplaceWebServiceOrders'</p></li>
  <li><p>The best overloaded method match for 'MarketplaceWebServiceOrders.OrderFetcher.OrderFetcher(MarketplaceWebServiceOrders.MarketplaceWebServiceOrders, string, string[])' has some invalid arguments</p></li>
  </ol>
  
  <p>The Line number of the error is 112: <code>job.orderFetcher = new OrderFetcher(service, sellerId, marketplaceIdList);</code></p>
  
  <p>OrderFetcher.cs</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Text;
  
  using MarketplaceWebServiceOrders.Model;
  
  namespace MarketplaceWebServiceOrders
  {    
      /// &lt;summary&gt;
      /// Sample helper class to Fetch Orders and OrderItems using the Amazon MWS Orders API.
      /// &lt;/summary&gt;
      public class OrderFetcher
      {
          public delegate void RetriableMethodCall();
          public delegate void ProcessOrderHandler(Order order);
          public delegate void ProcessOrderItemHandler(OrderItem orderItem);
  
          /// &lt;summary&gt;
          /// Default amount of time, in milliseconds, to sleep if a request is throttled; default to 1 per 10 minutes.
          /// &lt;/summary&gt;
          public const int DEFAULT_THROTTLED_WAIT_TIMEOUT = 10 * 60 * 1000;
  
          /// &lt;summary&gt;
          /// Default throttling limit for ListOrders calls; default to 1 per 12 seconds.
          /// &lt;/summary&gt;
          private const int LIST_ORDERS_DEFAULT_THROTTLE_LIMIT = 12 * 1000;
  
          /// &lt;summary&gt;
          /// Default throttling limit for ListOrderItems calls; default to 1 per 100 minutes.
          /// &lt;/summary&gt;
          private const int LIST_ORDER_ITEMS_DEFAULT_THROTTLE_LIMIT = 10 * 60 * 1000;
  
          private MarketplaceWebServiceOrders mwsService;
          private string mwsSellerId;
          private string[] mwsMarketplaceIdList;
          private DateTime lastServiceCall = DateTime.MinValue;
  
          private ProcessOrderHandler _processOrder;
          /// &lt;summary&gt;
          /// Event called when an order is received for processing.
          /// &lt;/summary&gt;
          public event ProcessOrderHandler ProcessOrder
          {
              add { _processOrder += value; }
              remove { _processOrder -= value; }
          }
  
          /// &lt;summary&gt;
          /// Creates a new instance of the OrderFetcherSample class.
          /// &lt;/summary&gt;
          /// &lt;param name="service"&gt;&lt;/param&gt;
          public OrderFetcher(MarketplaceWebServiceOrders service, string sellerId, string[] marketplaceIdList)
          {
              mwsService = service;
              mwsSellerId = sellerId;
              mwsMarketplaceIdList = marketplaceIdList;
          }
  
          /// &lt;summary&gt;
          /// Fetches all orders created between the starting time and the server's
          /// local system time minus two minutes.
          /// &lt;param name="startTime"&gt;The starting time period of orders to fetch.&lt;/param&gt;
          public void FetchOrders(DateTime startTime)
          {
              FetchOrders(startTime, DateTime.MinValue);
          }
  
          /// &lt;summary&gt;
          /// Fetches all orders created in the given time period and processes them locally.        
          /// &lt;param name="startTime"&gt;The starting time period of orders to fetch.&lt;/param&gt;
          /// &lt;param name="endTime"&gt;The ending time period of orders to fetch.&lt;/param&gt;
          public void FetchOrders(DateTime startTime, DateTime endTime)
          {
              ListOrdersRequest request = new ListOrdersRequest();
              request.CreatedAfter = startTime;
              if (endTime != DateTime.MinValue)
              {
                  request.CreatedBefore = endTime;
              }
              request.SellerId = mwsSellerId;
              request.MarketplaceId = new MarketplaceIdList();
              request.MarketplaceId.Id = new List&lt;string&gt;();
              foreach (string marketplaceId in mwsMarketplaceIdList)
              {
                  request.MarketplaceId.Id.Add(marketplaceId);
              }
  
              List&lt;Order&gt; orderList = new List&lt;Order&gt;();
              ListOrdersResponse response = null;
              OrderFetcher.InvokeRetriable(LIST_ORDERS_DEFAULT_THROTTLE_LIMIT, delegate()
              {
                  response = mwsService.ListOrders(request);
                  ProcessOrders(response.ListOrdersResult.Orders.Order);
              });
  
              String nextTokenString = response.ListOrdersResult.NextToken;
  
              while (!string.IsNullOrEmpty(nextTokenString))
              {
                  // If NextToken is set, continue looping through the orders.
                  ListOrdersByNextTokenRequest nextRequest = new ListOrdersByNextTokenRequest();
                  nextRequest.NextToken = nextTokenString;
                  nextRequest.SellerId = mwsSellerId;
  
                  ListOrdersByNextTokenResponse nextResponse = null;
                  OrderFetcher.InvokeRetriable(LIST_ORDERS_DEFAULT_THROTTLE_LIMIT, delegate()
                  {
                      nextResponse = mwsService.ListOrdersByNextToken(nextRequest);
                      ProcessOrders(nextResponse.ListOrdersByNextTokenResult.Orders.Order);
                  });
  
                  nextTokenString = nextResponse.ListOrdersByNextTokenResult.NextToken;
              }
          }
  
          /// &lt;summary&gt;
          /// Method called by the FetchOrders method to process the orders.
          /// &lt;/summary&gt;
          /// &lt;param name="orders"&gt;List of orders returned by FetchOrders&lt;/param&gt;
          protected virtual void ProcessOrders(List&lt;Order&gt; orders)
          {
              foreach (Order order in orders)
              {
                  if (_processOrder != null)
                  {
                      _processOrder(order);
                  }
              }
          }
  
          /// &lt;summary&gt;
          /// Fetches the OrderItems for the specified orderId.
          /// &lt;/summary&gt;
          public void FetchOrderItems(string orderId, ProcessOrderItemHandler handler)
          {
              if (handler == null) throw new ArgumentNullException("handler");
  
              ListOrderItemsRequest request = new ListOrderItemsRequest();
              request.SellerId = mwsSellerId;
              request.AmazonOrderId = orderId;
  
              ListOrderItemsResponse response = null;
              OrderFetcher.InvokeRetriable(LIST_ORDER_ITEMS_DEFAULT_THROTTLE_LIMIT, delegate()
              {
                  response = mwsService.ListOrderItems(request);
                  foreach (OrderItem orderItem in response.ListOrderItemsResult.OrderItems.OrderItem)
                  {
                      handler(orderItem);
                  }
              });
  
              String nextTokenString = response.ListOrderItemsResult.NextToken;
  
              while (!string.IsNullOrEmpty(nextTokenString))
              {
                  // If NextToken is set, continue looping through the orders.
                  ListOrderItemsByNextTokenRequest nextRequest = new ListOrderItemsByNextTokenRequest();
                  nextRequest.NextToken = nextTokenString;
                  nextRequest.SellerId = mwsSellerId;
  
                  ListOrderItemsByNextTokenResponse nextResponse = null;
                  OrderFetcher.InvokeRetriable(LIST_ORDER_ITEMS_DEFAULT_THROTTLE_LIMIT, delegate()
                  {
                      nextResponse = mwsService.ListOrderItemsByNextToken(nextRequest);
                      foreach (OrderItem orderItem in nextResponse.ListOrderItemsByNextTokenResult.OrderItems.OrderItem)
                      {                        
                          handler(orderItem);
                      }
                  });
  
                  nextTokenString = nextResponse.ListOrderItemsByNextTokenResult.NextToken;
              }
          }
  
          /// &lt;summary&gt;
          /// Invokes a method in a retriable fashion.
          /// &lt;/summary&gt;
          /// &lt;param name="throttledWaitTime"&gt;The amount of time to wait if the request is throttled.&lt;/param&gt;
          /// &lt;param name="method"&gt;The method to invoke.&lt;/param&gt;
          public static void InvokeRetriable(RetriableMethodCall method)
          {
              InvokeRetriable(DEFAULT_THROTTLED_WAIT_TIMEOUT, method);
          }
  
          /// &lt;summary&gt;
          /// Invokes a method in a retriable fashion.
          /// &lt;/summary&gt;
          /// &lt;param name="throttledWaitTime"&gt;The amount of time to wait if the request is throttled.&lt;/param&gt;
          /// &lt;param name="method"&gt;The method to invoke.&lt;/param&gt;
          public static void InvokeRetriable(int throttledWaitTime, RetriableMethodCall method)
          {
              bool retryRequest = false;
              do
              {
                  retryRequest = false;
                  try
                  {
                      // Perform some action
                      method.Invoke();
                  }
                  catch (MarketplaceWebServiceOrdersException ordersErr)
                  {
                      // If the request is throttled, wait and try again.
                      if (ordersErr.ErrorCode == "RequestThrottled")
                      {
                          Console.WriteLine("Request is throttled; waiting...");
                          retryRequest = true;
                          System.Threading.Thread.Sleep(throttledWaitTime);
                      }
                      else
                      {
                          // On any other error, re-throw the exception to be handled by the caller
                          throw;
                      }
                  }
              } while (retryRequest);
          }
      }
  }
  </code></pre>