A thread static instance?
time to read 1 min | 104 words
Without running this code, what would you expect this to do?
public class Strange
{
[ThreadStatic]
public /* static */ int Value;
}
var s1 = new Strange {Value = 1};
var s2 = new Strange { Value = 2 };Console.WriteLine(s1.Value);
Console.WriteLine(s2.Value);ThreadPool.QueueUserWorkItem(state =>
{
Console.WriteLine(s1.Value);
Console.WriteLine(s2.Value);
});
Can you guess?

Comments
Comment preview