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.

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

1 solution

Task<bool> t1 = new Task<bool>(() => IsPrime(numberBeingTested));
 
Share this answer
 
v2
Comments
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.
https://msdn.microsoft.com/de-de/library/system.threading.tasks.task(v=vs.110).aspx

What a lambda expression is you can find there:
http://www.codeproject.com/Tips/298963/Understand-Lambda-Expressions-in-minutes

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