我想要這個方法被編出來,所以我可以設置一個計時器而不是等待它完成。這是對服務的呼叫。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