When you wrap something in a text tag your are saying to Razor that "this is text" not code. If you want code you can then do a code block like:
<text>@{ var pattern = fjkfdkl; }</text>
If you are doing this in some sort of loop you can just continue writing your code:
foreach(var o in listOfObjects) {
var pattern = fjkfdkl;
}
In the above example razor knows whats code and what is not. You can then expand on the above example if you want to put markup in the loop:
foreach(var o in listOfObjects) {
var pattern = fjkfdkl;
<text>
Hello World!
</text>
}
or
foreach(var o in listOfObjects) {
var pattern = fjkfdkl;
<p>
Hello World.
<p>
}
You only really need to use the <text></text>
tags inside of loops where you don't have any html tags.
Razor is smart enough so when you open your tag inside a loop e.g. <p>
it know until that tag is closed then its in markup. When it is closed it will then look for a }
for the closing of a loop (or another html tag).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…