interface in Unity.SmartStrings.Core.Extensions
Lets a source stop formatter extensions from running for the placeholder it resolved.
SmartFormatter passes a FormattingInfo, which implements this interface,
as the ISelectorInfo argument of ISource.TryEvaluateSelector. Cast that argument to
IFormattingExtensionsToggle and set IFormattingExtensionsToggle.DisableFormattingExtensions to true
when default formatting can't reasonably handle the value the source found. The source can then write the output
itself with IFormattingInfo.Write, or write nothing.
Additional resources: ISource, FormattingInfo
using Unity.SmartStrings.Core.Extensions;
// Resolves {Password} to the real value, but writes a mask instead of formatting it. public class MaskedSource : ISource { public bool TryEvaluateSelector(ISelectorInfo selectorInfo) { if (selectorInfo.SelectorText != "Password") return false;
if (selectorInfo is IFormattingExtensionsToggle toggle) toggle.DisableFormattingExtensions = true;
if (selectorInfo is IFormattingInfo formattingInfo) formattingInfo.Write("********");
selectorInfo.Result = selectorInfo.CurrentValue; return true; } }
| Property | Description |
|---|---|
| DisableFormattingExtensions | Gets or sets whether formatter extensions are skipped for the current placeholder. |