Is it possible to have a function like this
public string Foo()
{
Task.Factory.StartNew(Foo2());
return "computedUniqueId";
}
The thing is that I want to start that Foo2 task AFTER Foo returns a value. The reason I ask this is that caller of Foo() function will be listening for information with that "computedUniqueId". Foo2() will trigger that information so there could be a situation that listener would not not what to wait for and will miss that message. So to summarize: Is there something(like continueWith) that will assert that Foo() returns its value before Foo2() kicks in ?
That's not possible because return is the last thing that happens in that method. After a return, the method in question has relinquished control and scope back to the caller. Period. The best I can think of is if you call Foo2 from where ever the string "computerUniqueId" is getting returned to.
Maybe if you supply more details we can help out more. Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With