Razor variable and delimited text

In a web form, this is possible:

<%: quantity %>x 

If the quantity is 2, it will display:

 2x 

In a razor, obviously, I cannot do this:

 @quantityx 

Because he will look for a quantityx variable that does not exist.

Of course, I can always:

 @(quantity.toString + "x") 

But I want to know if there is another way? Maybe there is a separator?

+4
source share
1 answer

You can use the following:

 @(quantity)x 
+5
source

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


All Articles