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

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -