How to write dynamic C # code when views not inherited by a browser in Razor MVC 3

I want to know how I can use Dynamic C # whenever I have not inherited my representations from a model.

- their way of writing dynamic C # in views whenever I use Razor.

how can i write razor code that matches this aspx cod

<% List<item> items = new List<item>(); %> 

how can I write this in my MVC 3 applications [razor]

+4
source share
2 answers
 @{ List<item> items = new List<item>(); } 

Scott Gu has a complete understanding of razor syntax .

+8
source

The basic rule:

<% =%> becomes @ ()

and

<%%> becomes @ {}

+8
source

Source: https://habr.com/ru/post/1335947/


All Articles