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

  • SEARCH
  • Home
  • 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 6938399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:29:19+00:00 2026-05-27T12:29:19+00:00

When a website simultaneously hits the same static method that has non-static variables, are

  • 0

When a website simultaneously hits the same static method that has non-static variables, are these variables static even though not declared static? I would assume so, but I had to ask.

Another option would be that different executions of the same code have different internal variables, so this code wouldn’t produce unexpected string lengths for example:

public static class MyClass 
{
    public static int getResult(string ext)
    {
        int length = est.length;  // One place in RAM or multiple?
        Thread.Sleep(5000);       // Does this stop program execution for others?
        return length;
    }
}

Question summary:

  1. Are static method variables that are not declared static implied static, i.e. simultaneous execution of static code will affect each other?
  2. or do these variables have their own storage each?
  3. and does Thread.Sleep(5000) in a static method stop all user’s execution?
  • 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-05-27T12:29:19+00:00Added an answer on May 27, 2026 at 12:29 pm

    You’re showing local variables. So no, those aren’t static variables. Each time you invoke the method (including if it invoked itself recursively), you get a new set of variables. Different threads will not be sharing those variables. Note that this has nothing to do with the class being a static class. You need to differentiate between:

    • Local variables, which belong to the method that declares them
    • Instance variables, associated with a particular instance of the declaring type
    • Static variables, associated with the declaring type itself (and not with any specific instance)

    Thread.Sleep only makes the current thread sleep – if your application has multiple threads, the others will still be able to execute.

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

Sidebar

Related Questions

I'm maintaining a website that has full screen background photos, and a text panel
My website has a navigation bar that when clicked targets an iframe. i would
I'm moving a website to Wordpress and simultaneously changing the convoluted URL structure they
My website has been giving me intermittent errors when trying to perform any Ajax
My website has premium videos, for which users have to pay to watch it.
I’m having some trouble with understanding how IIS is handling static variables on its
I am using a CMS that hosts multiple websites simultaneously and I am seeking
I am developing an iPhone application and a website simultaneously. I plan on making
I am making an iPhone application and Website simultaneously and I want a shared
I have an asp.net website that stores events inside a database table. Then I

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.