我想要这个方法被编出来,所以我可以设置一个计时器而不是等待它完成。这是对服务的呼叫。c中的线程问题#
private static void callValueEng(ValueEngineService.Contracts.ValueEngServiceParams param)
{
using (WCFServiceChannelFactory<IValueEngineService> client =
new WCFServiceChannelFactory<IValueEngineService>(
Repository.Instance.GetWCFServiceUri(typeof(IValueEngineService))))
{
client.Call(x => x.ValueManyTransactionsWithOldEngines(translatedParams));
}
}
我试着穿出来像这样:
System.Threading.Thread newThread;
//RestartValueEngineService();
List<TransactionInfo> currentIdsForValuation = ((counter + 7000) <= allIds.Count)
? allIds.GetRange(counter, 7000)
: allIds.GetRange(counter, allIds.Count - counter);
translatedParams.tranquoteIds = currentIdsForValuation;
// thread this out
newThread = new System.Threading.Thread(callValueEng(translatedParams));
但它说“的最佳重载的比赛有一些无效的参数。”我究竟做错了什么?
如何传递它的参数? – slandau
修正了它,犯了一个错误(忽略了参数) – Bas
BeginIvoke不会创建一个新的线程 – sll