Quantcast
Channel: Using VB.NET IIF I get NullReferenceException - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by bdukes for Using VB.NET IIF I get NullReferenceException

IIf is an actual function, so all arguments get evaluated. The If keyword was added to VB.NET 2008 to provide the short-circuit functionality you're expecting.TrylogLine = "e.Value: "+ If(e.Value Is...

View Article



Answer by Philip Fourie for Using VB.NET IIF I get NullReferenceException

This is the expected behaviour.IIF is a function; therefore the parameters for the function will be evaluated before sending it to the function.In contrast, the ternary operator in C# is a language...

View Article

Answer by Chris Farmer for Using VB.NET IIF I get NullReferenceException

VB does not do short-circuiting evaluation in Iif. In your case, e.Value.ToString() is being evaluated no matter whether e.Value is nothing.

View Article

Using VB.NET IIF I get NullReferenceException

I am doing a little debugging, and so I want to log the eventArgs valueI have a simple line that basically does:logLine = "e.Value: "+ IIf(e.Value Is Nothing, "", e.Value.ToString())The way I...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images