Click here to Skip to main content
15,511,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
IsPrime returns bool.

Task<bool> t1 = new Task<bool>(IsPrime(numberBeingTested));

1 solution

Task<bool> t1 = new Task<bool>(() => IsPrime(numberBeingTested));
Share this answer
Kyle Gottfried 28-Jul-15 1:17am    
Thank you very much, the solution made the syntax error disappear. Could you explain or provide a reference to the concept used in the solution?
stibee 28-Jul-15 1:26am    
Whats the reason you like to create a task?
A tasks needs an action to execute if you call start.

What a lambda expression is you can find there:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900