C# 使用操作将条件参数传递给方法

C# 使用操作将条件参数传递给方法,c#,delegates,C#,Delegates,我正在Silverlight 4.0项目中使用MVVM模式。此项目正在从WCF服务获取数据 以下是获取装运方法集合的示例: 接口: 服务代理: ea.Result将按服务从中获取装运方法的列表 我的问题是,当我想要获取发票项目列表时,我需要传入InvoiceID,以便返回的结果将仅为特定发票提供发票项目集合 有没有办法传入可以传递给我的WCF服务的输入参数 更新: 事实证明,这很简单: 我需要做的就是添加一个条件参数 void GetShippingMethods(Action<Obser

我正在Silverlight 4.0项目中使用MVVM模式。此项目正在从WCF服务获取数据

以下是获取装运方法集合的示例:

接口:

服务代理:

ea.Result将按服务从中获取装运方法的列表

我的问题是,当我想要获取发票项目列表时,我需要传入InvoiceID,以便返回的结果将仅为特定发票提供发票项目集合

有没有办法传入可以传递给我的WCF服务的输入参数

更新: 事实证明,这很简单: 我需要做的就是添加一个条件参数

void GetShippingMethods(Action<ObservableCollection<ShipVia>, Exception> completed, int MethodID);

感谢您发布答案。。
 public void GetShippingMethods(Action<ObservableCollection<ShipVia>, Exception> completed)
    {
      InvoiceServiceClient client = new InvoiceServiceClient();
      client.GetShippingMethodsCompleted += (s, ea) =>
      {
        if (ea.Error != null)
        {
          completed(null, ea.Error);
        }
        else
        {
          completed(ea.Result, null);
        }
      };

      client.GetShippingMethodsAsync();

      client.CloseAsync();

}
void GetShippingMethods(Action<ObservableCollection<ShipVia>, Exception> completed, int MethodID);