Implicit Razor Expressions

Implicit Razor expressions start with @ and are followed by C# code. These must not contain spaces (except with the await keyword):

<p>@DateTime.Now</p>
<p>@DateTime.IsLeapYear(2016)</p>

No Generics

Implict expressions cannot contain C# generics: the characters inside < > are evaluated as an HTML tag.
Invalid: <p>@GenericMethod<int>()</p>

To make genric method calls, use explicit Razor expressions.

Explicit Razor Expressions

Explicit Razor expressions use an @ symbol and paranthesis:

<p>Last week this time: @(DateTime.Now - TimeSpan.FromDays(7))</p>

Explicit expressions can contain spaces (like above) while implicit expressions cannot:
Invalid: <p>Last week: @DateTime.Now - TimeSpan.FromDays(7)</p>

Explicit expressions can concatenate text with an expression result:

@{
    var joe = new Person("Joe", 33);
}
<p>Age@(joe.Age)</p>

Explicit expressions can render output from generic methods:

<p>@(GenericMethod<int>())</p>