Difference between ( ) (parenthesis) and { } (curly brackets) in Razor

前端 未结 3 729
孤街浪徒
孤街浪徒 2021-02-05 03:51

What is the difference between them both. I thought they were the same but today I realized that they are not.

Why this is correct

@(Model.WillAttend ==         


        
3条回答
  •  忘了有多久
    2021-02-05 04:40

    If you're familiar with WebForms, it's very similar to the difference between <%= %> (or <%: %>) and <% %>. The former is evaluated then outputted to the page, the latter is a block of code that can do whatever it needs (but isn't written to the page).

提交回复
热议问题