Reproduce Capturing iteration variable issue

前端 未结 3 1001
时光取名叫无心
时光取名叫无心 2021-01-22 20:01

I\'m rereading a part from c# 5.0 in Nutshell about the capturing iteration variables (Page 138) and I have tried to reproduce the code bellow on c# 4.0 and c# 5.0 but with n

3条回答
  •  野性不改
    2021-01-22 20:15

    Because this issue has been fixed in C# compiler 5.0, you can't reproduce it with Visual studio 2012.

    You need to use the C# compiler version 4.0 to reproduce the issue which author is trying to explain. With Visual studio 2010 you can reproduce the problem.

    Even if you change the Language version in Vs2012, it still won't work. because you're still using the C# 5.0 compiler.

提交回复
热议问题