Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8724273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:47:45+00:00 2026-06-13T07:47:45+00:00

It is my approach not to use static methods and classes within asynchronous operations

  • 0

It is my approach not to use static methods and classes within asynchronous operations – unless some locking technique is implemented to prevent race conditions.

Now async/await has been introduced into the c# 4.5+ framework – which simplifies multithreaded applications and encourages responsive UI.

However – as a lock cannot/should not be placed over an awaiting method (and I’m not debating that) does that now make static methods utilizing async/await completely redundant?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:47:47+00:00Added an answer on June 13, 2026 at 7:47 am

    It is my approach not to use static methods and classes within asynchronous operations – unless some locking technique is implemented to prevent race conditions.

    Why? Unless you’re actually using shared state, there shouldn’t be any race conditions. For example, consider:

    public static async Task<int> GetPageLength(string url)
    {
        string text = await new WebClient().DownloadStringTaskAsync(url);
        return text.Length;
    }
    

    If you do have shared state – or if you’re in an instance method on an instance which is used by multiple threads – you need to work out how you would ideally want your asynchronous operation to work. Once you’ve decided how the various races should behave, actually implementing it may well be fairly straightforward.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to this AJAX approach when you're not supposed to use UpdatePanel but
I'm not quite sure how to approach this issue: I am creating a web
I'm not sure how to approach this SQL statement so please advise, even if
I'm not sure how to approach queries that don't map 1:1 to my persistent
I'm not sure how to approach this or if it is even feasible. I
Not totally sure how to approach this. I've researched a bit but I've come
Hoping you can help as im not sure how to approach this. Cant seem
Apologies if I I just did not figure out the actual approach but I
Actually I was not sure so, I followed git amend approach everytime. Is it
I have the following to solve and I'm not sure how to approach this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.