Skip to content

InterpolateMustache Method ​

Definition ​

  • Namespace: JASE.Extensions
  • Assembly: JASE.ReflectionTools.dll

string InterpolateMustache(string input, object model, bool preserveMissingProperties = null, bool htmlEncodeValues = null) ​

csharp
string InterpolateMustache(string input, object model, bool preserveMissingProperties = null, bool htmlEncodeValues = null)

Replaces Mustache-style double-brace placeholders {{property}} with values from model.

Parameters ​

NameDescription
htmlEncodeValuesWhen (default), HTML-encode substituted values (System.Net.WebUtility.HtmlEncode(System.String)). Set only when values are already trusted markup.
inputTemplate text containing {{property}} or dotted {{path.to.Value}} tokens.
modelObject or dictionary whose properties supply placeholder values.
preserveMissingPropertiesWhen , leave unmatched placeholders unchanged; when (default), replace them with empty string.

Returns ​

The interpolated string.

Remarks ​

Use when the template may contain HTML or CSS. Double braces do not collide with CSS { rule } blocks, unlike single-brace Interpolate.

Name is industry shorthand for double-brace placeholders only — not full Mustache (no sections, partials, or #/^). Tokens must be tight: {{name}} matches; {{ name }} does not.

For plain messages with no markup, prefer Interpolate ({property}).