There is a better solution for string parameter substitution in. NET Razorengine
We recommend you look at the original site, and then make a small connection, and then you understand.
First you have to download one,
vs tools-> Library Paging Manager->manager Nuget in then what Install-package razorengine wait for the search to end and then download down two DLLs
RazorEngine.dll didn't see? must refer to the project.
System.Web.Razor.dll This DLL project is a reference to the many to be prompted to replace, do not hesitate to replace it, and then right-click the DLL to see his version oh, because version of the inconsistency is Will cause the DLL to find no drops! Change the version on the Web. config, and then add the RazorEngine.dll to config as well!
So we can use the Razorengine!
To be in C # backstage code with HA ~, or how to compile it
Razorengine will generate a temporary. cs file for the template, and then compile and invoke it.
//string can also be a JS string
//@ "<script type= ' text/javascript ';
//Balabala a bunch of JS code
//</script>" This is also possible.
string template =
@ " < html> " var model = new Pagemodel {Name = world " Span style= "Color:rgb (128, 0, 0); > ", Email = " [email Protected] " }; string result = Razor.parse (template, model);
See if it is very simple to use,@Model This represents the Pagemodel object, the return value of the C # method to go to a htmlstring, the premise is that the data is a code that can be run directly in HTML