RazorEngine<TBaseTemplateType>.RenderTemplate

Execute a template based on a TextReader input into a provided TextWriter object.

public string RenderTemplate(string templateText,
	object model,
	TextWriter outputWriter,
	bool inferModelType)

Return Value

output from template. If an outputWriter is passed in result is string.Empty on success, null on failure

Parameters

templateText
A string that contains the markup template

model
Optional model available in the template as this.Context

outputWriter
A text writer that receives the rendered template output. Writer is closed after rendering. When provided the result of this method is string.Empty (success) or null (failure)

inferModelType
If true, tries to infer the model type when no @model or @inherits tags are defined for the template

Overloads:


See also:

Class RazorEngine

© West Wind Technologies, 2018 • Updated: 06/07/18
Comment or report problem with topic