T
teddysnips
I'm new to C# - recent background mainly ASP.NET with VB.NET.
Anyhoot, I needed to create a C# statement analogous to VB's IIf:
VB.NET
Dim e As Boolean
e = IIf((CInt(MyVariable) > 0), True, False)
C#
bool e = ((int)MyVariable > 0) ? true : false;
It compiles and runs fine under C#, but the "false" word has a wiggly
green line underneath and the legend in the Warnings tab of the Errors
pane:
"Unreachable expression code detected"
Don't understand - can anyone shed light?
Thanks
Edward
Anyhoot, I needed to create a C# statement analogous to VB's IIf:
VB.NET
Dim e As Boolean
e = IIf((CInt(MyVariable) > 0), True, False)
C#
bool e = ((int)MyVariable > 0) ? true : false;
It compiles and runs fine under C#, but the "false" word has a wiggly
green line underneath and the legend in the Warnings tab of the Errors
pane:
"Unreachable expression code detected"
Don't understand - can anyone shed light?
Thanks
Edward