Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IFormattingExtensionsToggle

Lets a source stop formatter extensions from running for the placeholder it resolved.
Read time 1 minuteLast updated 8 days ago

Definition

public interface IFormattingExtensionsToggle

Remarks

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

Examples

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; }}

Properties

Property

Description

DisableFormattingExtensionsGets or sets whether formatter extensions are skipped for the current placeholder.