C# is stupid
Sometimes C# just torques me off. Especially when it doesn’t give useful errors. I wrote the following line of code:
if (((string)e.Row.Cells[3].Value = “Yes”)) {}
Which of course should have been:
if (((string)e.Row.Cells[3].Value == “Yes”)) {}
The errors I got were:
The left-hand side of an assignment must be a variable, property or indexer
and
Cannot implicitly convert type 'string' to 'bool'
Why can’t it just say:
Hey stupid C#-wannabe former-VB.NET-programmer, you meant '=='.
Instead I spent 5 minutes trying different things before I noticed the typo.
D’oh!
2 Comments
- Jeremy said:
- Dan said: