P
Peter K
Say I have this class
public class Simple
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
Is it "thread safe"? Multiple threads can certainly access their own
instances of Simple without problems...
But what if I have another class which has a "static reference" to Simple:
public class StaticReference
{
private static Simple simple = new Simple();
public static Simple
{
get { return simple; }
}
}
Now if I have multiple threads accessing StaticReference then they can
upset each other by altering the Name property on the "simple" instance
they share, correct? So is "StaticReference" thread-safe?
Thanks,
Peter
public class Simple
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
Is it "thread safe"? Multiple threads can certainly access their own
instances of Simple without problems...
But what if I have another class which has a "static reference" to Simple:
public class StaticReference
{
private static Simple simple = new Simple();
public static Simple
{
get { return simple; }
}
}
Now if I have multiple threads accessing StaticReference then they can
upset each other by altering the Name property on the "simple" instance
they share, correct? So is "StaticReference" thread-safe?
Thanks,
Peter