Razor doesn't look like my single-line If statements ... Usually in VB.NET I can write a single-line If statement like this:
If True Then Dim x As Integer
However, when I do the same with Razor in a .vbhtml file like this ...
@If True Then Dim x As Integer
I get an error
The If block has not been completed. All "If" statements must be completed using the appropriate "End If".
What gives? Why won't the razor take this? I understand that a simple solution is to just use a code block, for example
@code If True Then Dim x As Integer End Code
But that is not what I am looking for. I'm curious why Razor cannot recognize the VB.Net instruction of a single If line, using only @If... Any ideas?
source share