Here are three ways you can extend your usage of the normal VB.NET 'if then else' conditional: AndAlso/OrElse, Single Line, and If And Only If. They can not only save you processing time but also make your code easier to read.
AndAlso/OrElse
You can use short-circuit evaluation where subsequent conditions don't ever execute unless the previous conditions aren't adequate enough to determine the overall result of the conditional. This is particularly useful when performing existence checks, like the example below.
Dim myStrings As List(Of String) = Nothing
If myStrings IsNot Nothing AndAlso myStrings.Count > 0 Then
Debug.WriteLine("Hello World!")
End If
If you were using a regular "And" instead of an "AndAlso" you would get a NullReferenceException because it would try to perform the Count method in the second part of the condition. You would have had to nest the conditionals and that gets messy.
The same works for OrElse.
Dim myInteger As Integer = 4
Dim myBoolean As Boolean = True
If myBoolean = True OrElse myInteger > 5 Then
Debug.WriteLine("Hello World!")
End If
The second condition never needs to execute because the first condition met the criteria.
Single Line
You can abbreviate your single execution code into a single line conditional like the example below.
If myInteger > 5 Then Debug.WriteLine("more")
If myInteger > 5 Then Debug.WriteLine("more") Else Debug.WriteLine("less")
If And Only If
You can also use the IIF function (if and only if) like the example below.
Debug.WriteLine(IIf(myInteger > 5, "more", "less"))
Be careful when using this though, because it does not use short-circuit evaluation so both the true and false will be evaluated.