After reading Jon Skeet article , and this article from msdn , I still have a question
Let's say I have this code :
MyPerson mp = new MyPerson(); //Field
int g=0; //Field
public void DoWork ()
{
int i;
MyPerson mp2 = new MyPerson();
...
}
Now let's say I have 2 threads. which runs DoWork
. ( let's ignore for now , race conditions)
Will they both see the same
g
or each thread will have its own item ? ? ( value )Will they both see the same
mp
or each thread will have its own item ?? ( instance )Will they both see the same
i
or each thread will have its own item ? ( value )Will they both see the same
mp2
or each thread will have its own item ? ( instance )if they both see the same , why would I need
static
?
I've searched a lot about this topic , and couldn't find any article which states : Different Threads ,ref types and value types... )