Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Razor variable and text without separator

Tags:

razor

In webform this is possible:

<%: quantity %>x

If quantity is 2, it will display:

2x

In razor obviously I cannot do this:

@quantityx

Because it will then look for variable quantityx which doesn't exist.

Of course I can always do:

@(quantity.toString + "x")

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

like image 782
Endy Tjahjono Avatar asked Mar 09 '12 09:03

Endy Tjahjono


1 Answers

You can use the following:

@(quantity)x
like image 180
Steve Wilkes Avatar answered Oct 20 '22 02:10

Steve Wilkes