c# - How may I resolve this error? - Delegate 'System.Action<object>' does not take 0 arguments -
the following code:
var ui = taskscheduler.fromcurrentsynchronizationcontext(); task.factory.startnew(() => { listbox1.items.add("starting crawl " + srmainsiteurl + "..."); } , ui);
is resulting in following error:
delegate 'system.action<object>' not take 0 arguments
after looking @ other threads, have not been able determine nor understand cause of error. please advise.
because did use
public task startnew(action<object> action, object state)
i think wanted use
public task startnew(action action, cancellationtoken cancellationtoken, taskcreationoptions creationoptions, taskscheduler scheduler)
so example become:
task.factory.startnew(() => { listbox1.items.add("starting crawl " + srmainsiteurl + "..."); }, cancellationtoken.none, taskcreationoptions.none, ui);
Comments
Post a Comment