Search code examples
c#.netrazorengine

issue with RazorEngine variable parsing


In my page, I'd like to display a string like this:

Today is (x)th of july

Where (x) is calculated by progam at runtime and passed as @Model.Number to RazorEngine

However the following template format will not work as I expected

Today is @Model.Numberth of july

In many cases I have to put variables and plain text together without spaces. How can I improve my code to make it work?


Solution

  • try using this

    Today is @(Model.Number)th of july