Iterations and Code Blocks

In this lesson, we will look at iterating a template snippet over data and forcing the C# syntax mode.

Iterative statements

Razor allows the iteration of a template over a collection of data. The simplest way to do it is by using the foreach statement:

Get hands-on with 1400+ tech skills courses.