If I have the following class:
public class MyClass { public static int MyStaticInt = 0; }
If in the one solution I refer to MyNameSpace.MyClass.MyStaticInt
in two different assemblies, am I referring to the same variable?
Static state is scoped per AppDomain
by default and can be configured to be by thread if you use the ThreadStatic
attribute.
This means that your assumption is valid if the assemblies are running in the same process and the process has only one application domain.
static
can mean several things depending on context.
AppDomain
.ThreadStatic
attribute, you get one instance of the value per thread.For your example code, the first condition appears to be the case. In all cases, the specific assembly that the data is defined in does not make any difference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With