“ThreadStaticVariable” (Problem)

What will the following code display?

[ThreadStatic]
static readonly int Foo = 42;

void Main()
{
  var thread = new Thread(() => Console.WriteLine(Foo));
  thread.Start();
  thread.Join();
}

Solution

Last updated