I am trying to prevent the task from completing if the first part does not work.
My code is as follows:
Task listener = Task.Factory.StartNew(openConnection).ContinueWith((t) => listenForNumber());
void openConnection()
{
try
{
}
catch
{
}
}
void listenForNumber()
{
}
Now listenForNuber () should not be executed if openConnection () is included in the catch block
I tried ContinueWith((t) => listenForNumber(),TaskContinuationOptions.NotOnFaulted);
But no success, no help ?: (
thank
Ekoms source
share