Simple Form Threading
(ASYNC,TASK)
Very Simple Tutorial
Simply Make a Async Task. (Not Hard)
private async Task RunTask()
{
await Task.Run(Functions); // Task.Run(YourFunctionVoid);
}
Then just make a button or an event to call the async task.
private void startBtn_Click(object sender, EventArgs e)
{
RunTask();
}
Now you can run your "function" without your application freezing.
Extension
Some extras about async.
How to run functions side by side ?
simply use Task.WaitAll to achieve them running asynchronously
Task.WaitAll(Function1(), Function2()); // Run the two functions side by side
You can also merge all the methods in this thread together.
For example
await Function1(); // When this function has finshed it will move on.
Task.WaitAll(Function2(), Function3()); // Then it will execute this and run func2 and func3 at the same time
Short tutorial but people need some form of threading in there applications.