Razor Syntax
Explore Razor syntax to effectively build Blazor WebAssembly applications. Understand how to combine HTML, Razor markup, and C# with inline expressions, conditionals, and loops to create dynamic components. Gain practical knowledge of control structures like if, switch, for, foreach, while, and do while loops for web app development.
We'll cover the following...
We'll cover the following...
Razor syntax is made up of HTML, Razor markup, and C#. Rendering HTML from a Razor component is the same as rendering HTML from an HTML file. The HTML in a Razor component is rendered by the server unchanged. Razor syntax uses both inline expressions and control structures.
Inline expressions
Inline expressions start with an @ symbol followed by a variable or function name. This is an example of an inline expression: