Endy Tjahjono
Endy Tjahjono

Reputation: 24500

Razor variable and text without separator

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?

Upvotes: 5

Views: 363

Answers (1)

Steve Wilkes
Steve Wilkes

Reputation: 7135

You can use the following:

@(quantity)x

Upvotes: 6

Related Questions