Imagine a static method called foo() that is taking a considerable amount of time to execute. This method is inside a static class.
public static class FooClass
{
public static void Foo()
{
Thread.Sleep(120000); // 2 minutes.
}
}
I have a two instances of the same class that are calling this method concurrently. Since the FooClass is static, does that mean that Instance2 has to wait for Instance1 to finish executing foo() (given that Instance1 entered foo() first)?
From my knowledge, static classes contains one instance that is shared across the application pool.
public void Foo()instead ofpublic static void Foo()which would not compile asFooClasswas marked as static.