Q:

One line If statement with Razor and .NET

Razor doesn't seem to like my one line If statements... Normally in VB.NET, I can write a one line If statement like so:
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 the error

The "If" block was not terminated. All "If" statements must be terminated with a matching "End If".

What gives? Why won't Razor take this? I realize that a simple solution is to just use a code block like
@code
    If True Then Dim x As Integer
End Code

But thats not what I'm looking for. I'm curious why Razor can't recognize a VB.Net one line If statement using just @If.... Any ideas?

A:

In VB.Net you do a inline If Statement like this:
@(If(boolCondition, "truePart", "falsePart"))

A:

Same problem with C#, As explained here : 

Razor uses code syntax to infer indent: Razor Parser infers code
  ending by reading the opening and the closing characters or HTML
  elements. In consequence, the use of openings “{“ and closings “}” is
  mandatory, even for single line instructions

You do the wright thing
@code
    If True Then Dim x As Integer
End Code

You can do it like that but it's not you like (inline)
@If (True) Then
    Dim x As Integer
End If

