C# - The CS0136 that shouldn't be
I have no idea why this line is getting an CS0136 error...
if (开发者_Python百科s => scoresint[0])
"s" was already declared as an integer, but even then, I'm not re-declaring it here, so there should be no issue. Any ideas?
=>
is the lambda operator, which implicitly declares a new s
.
You likely want >=
.
As Mr. White points out, you want >=
. To understand why you're getting the error, s => scoresint[0]
is declaring an anonymous function whose parameter will be named s
. Since that name is already used by your local variable, the compiler reports the error you see.
精彩评论