1
Vote

@Model not recognized when there is no space

description

I'm trying to do the following:

string template = "Hello@Model.Name";
string result = Razor.Parse(template, new { Name = "World" });

I expect to get the following result: HelloWorld, instead I get Hello@Model.Name @Model.Name is not recognized.

Is there a way to do this?

comments

cmills2000 wrote Apr 24, 2015 at 8:33 PM

Try string template = "Hello@(Model.Name)";