Hi all,
I have a 3 different method what I need to do is using foreachloop I need to loopnthrough the methods based on types and use asymc await task.when all method to get all the response and show to the end user
How can I do that
Hi all,
I have a 3 different method what I need to do is using foreachloop I need to loopnthrough the methods based on types and use asymc await task.when all method to get all the response and show to the end user
How can I do that
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
siva nathanPosted Jan 30, 2024, 11:34 AM
Hi jignesh,
I called the 3 methods as like you mentioned but second and third methods are executed and returned the result Without first method returned the results
It is not waiting all the methods get executed
Jignesh KumarPosted Jan 30, 2024, 10:18 AM
In above example that is use for testing purpose because we want to wait until all task completed. Our case after 6 seconds all methods should execute.
In your case just need to add all methods as task and call like my example should work.
Could you please share your code so can check on that?
siva nathanPosted Jan 30, 2024, 10:05 AM
Hi jignesh,
Why we are adding Tas.delay() in each and every method
May I know the use case
If we are not using that delay what will happen
Jignesh KumarPosted Jan 30, 2024, 9:54 AM
Hello Shiva,
You can use Task.WhenAll() as below in realtime.