C# | Put time consuming operations in thread

Assuming that we have a time consuming operation in a function called TimeConsOperation. To execute it in a separated thread do the following:

private void someFunction() {
    Thread _thread = new Thread(new ThreadStart(TimeConsOperation));
    _thread.Start();
}
 
private void TimeConsOperation()
{
    for(;;)
    {
        ..
    }
}
Categories: C# Tags: , , , , , ,
%d bloggers like this: