I want to reducing linq code below and convert C# 2005
private void cmdCaculator_Click(object sender, EventArgs e)
{
int rowcount = gridView1.RowCount;
Thread myThr = new Thread(() =>
{
for (int i = 0; i < rowcount; i++)
{
x *=i;
}
});
myThr.Start();
}
There's no LINQ in that code - just a lambda expression. You can use an anonymous method instead:
private void cmdCaculator_Click(object sender, EventArgs e)
{
int rowcount = gridView1.RowCount;
Thread myThr = new Thread(delegate ()
{
for (int i = 0; i < rowcount; i++)
{
x *= i;
}
});
myThr.Start();
}
However, I would strongly recommend that you update your toolchain. By restricting yourself to C# 2 you're missing out on lots of massively useful features.
See more on this question at Stackoverflow