I am learning about Tasks and running them in Parallel and for my test I had 3 functions that I would run in parallel each returning a string. I wanted to add each of those returned strings to another string and display the final result.
string result;
Parallel.Invoke(() => SomeFunction(),
() => AnotherFunction(),
() => AndAnother());
private string SomeFunction()
{
return "1";
}
private string AnotherFunction()
{
return "2";
}
private string AndAnother()
{
return "3";
}
How would I (if possible) get the values ("1", "2", "3") so that I could set it to result?
Apologies in advance, I am quite new to programming and this is my first post I believe so if the structure of the question is off or could have been presented in a better way please let me know!