如何在 C# 中正确调用处理程序方法?

How to properly call handler method in C#?

我在使用下面的方法 -GetTransactionsCompletedEventHandler 时遇到问题。我试图将必要的参数传递给它,但它还要求以我不熟悉的格式提供更多参数。

它正在请求 GetTransactionsCompletedEventHandler(object[] results(object, GetTransactionsCompletedEventArgs)target)

任何人都可以指出如何正确调用此方法的正确方向吗?

static object[] results;
static Exception exception;
static bool cancelled;
static object userState;
TransactionService.GetTransactionsCompletedEventArgs test1 = new TransactionService.GetTransactionsCompletedEventArgs(results, exception, cancelled, userState);

public void testMethod()
{
}
static List<string> orderlist;
public object testObject;
public void getTransactions()
{
    TransactionService.GetTransactionsCompletedEventHandler test = new TransactionService.GetTransactionsCompletedEventHandler(testObject, test1);
}

感谢有用的评论。我发现我做错了,应该只实例化一个服务,这样就可以获取交易了。

TransactionService.TransactionService _service = new TransactionService.TransactionService();
TransactionService.TransactionSearchParameters _params = new TransactionService.TransactionSearchParameters();
TransactionService.Transaction []list = _service.GetTransactions(_params);