Home Can I use multiple await methods inside an async method?
Reply: 0

Can I use multiple await methods inside an async method?

KrishOnline
1#
KrishOnline Published in 2017-12-05 22:20:17Z

This question already has an answer here:

  • Does the use of async/await create a new thread? 1 answer
  • Multiple Awaits in a single method 3 answers

I just want to know is it a best approach to use multiple await in one async method C# Web API ASP.NET Core 2.0.

I want to know whether or not its a good approach to handle high traffic. Will it create multiple Threads or lead to Thread block anything like that.

public async Task<EncryptText> EncryptText(string PlainText)
{
        try
        {
            keyResult = (await RsaDecrypt(new DecryptReq {CipherText = Text})).PlainText;
            var result = await GenerateEncryptedText(context, keyResult);

            return new EncryptedText
            {
                CipherText = result.CipherText
            };
        }
        catch (Exception exception)
        {
            throw new Exception("Error");
        }
}
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30152 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO