Skip to content

Interpolate Method ​

Definition ​

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

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

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

Replaces single-brace placeholders {property} with values from model.

Parameters ​

NameDescription
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 ​

Plain-text templates only. Use this for messages and short strings that are not HTML or CSS. CSS rule blocks and other non-identifier {…} content are ignored because only strict property-name tokens match — not because the method parses CSS. Tokens must be tight — { name } does not match.

For HTML or CSS (or any text that already uses {/}), use InterpolateMustache with {{property}} instead. Do not pass Mustache templates here: Interpolate("Hello {{name}}") matches the inner {name} and yields Hello {Ada}.