Strange error
I wrote this simple program in linqpad
class Program
{
public static void Write1(int i)
{
Console.Write(i) ;
Thread.Sleep(50) ;
}
static void Main(string[] args)
{
for (var i = 0; i < 5; i++)
{
var value = i;
var runningTask = Task.Factory.StartNew(()=>Write1(value)) ;
}
Console.ReadKey() ;
}
}
It gives me a error saying " 'object' does not contain a constructor that takes 1 arguments"
but this does not specify the line where the error is.
I write the same in visual studio and it works.
Anyone know what I am doing wrong here?
class Program
{
public static void Write1(int i)
{
Console.Write(i) ;
Thread.Sleep(50) ;
}
static void Main(string[] args)
{
for (var i = 0; i < 5; i++)
{
var value = i;
var runningTask = Task.Factory.StartNew(()=>Write1(value)) ;
}
Console.ReadKey() ;
}
}
It gives me a error saying " 'object' does not contain a constructor that takes 1 arguments"
but this does not specify the line where the error is.
I write the same in visual studio and it works.
Anyone know what I am doing wrong here?
Comments
http://share.linqpad.net/fg8c4x.linq
Or remove the Program class declaration, like this:
http://share.linqpad.net/mfo9sg.linq