RickStrahl / Westwind.RazorHosting

Hosting the Razor Runtime outside of ASP.NET/MVC for use in non-Web .NET applications.
144 stars 32 forks source link

Class AppTemplates in landing page doesn't compile #22

Closed ManfredLange closed 6 years ago

ManfredLange commented 6 years ago

Landing page at https://github.com/RickStrahl/Westwind.RazorHosting contains an example class AppTamplate with a method named RenderTemplate()

I receive a compile error in my environment. It appears as if the parameter error is missing a type. Therefore I changed the signature to the following:

public static string RenderTemplate(string template, object model, out string error)

and as a consequence added the following as a first line in the method:

error = string.Empty;

And - using latest C# syntax - the call using this class should then be changed to

AppTemplates.RenderTemplate("~/header.cshtml", topic, out string error);

Admittedly the class is only meant to give a starting point. I think, though, that it should be syntactically correct. Perhaps I'm overlooking something, though.

RickStrahl commented 6 years ago

That's fine. The example syntax uses C# 7 syntax using auto-initialization.