Method TryFormat
TryFormat(string, out string)
Attempts to format the text, returning a value indicating success.
public static bool TryFormat(string text, out string result)
Parameters
textstringThe raw dictation text to format.
resultstringWhen this method returns, contains the formatted text if formatting succeeded; otherwise,
null.
Returns
- bool
trueif formatting succeeded; otherwise,false.
Remarks
This method catches any exceptions that occur during formatting and returns false
instead of throwing. Use this method when robust error handling is required.
TryFormat(string, FormatterOptions, out string)
Attempts to format the text with the specified options, returning a value indicating success.
public static bool TryFormat(string text, FormatterOptions options, out string result)
Parameters
textstringThe raw dictation text to format.
optionsFormatterOptionsThe formatting options to use. If
null, default options are applied.resultstringWhen this method returns, contains the formatted text if formatting succeeded; otherwise,
null.
Returns
- bool
trueif formatting succeeded; otherwise,false.