<Code Lib>
M

UnitFormatUtils.TryParse(Units, UnitType, String, Double, String)

Description:
Parses a formatted string into a number with units if possible.

[ObsoleteAttribute("This method is deprecated in Revit 2021 and may be removed in a future version of Revit. Please use the `TryParse(Units, ForgeTypeId, string, out double, out string)` overload instead.")]
public static bool TryParse(
	Units units,
	UnitType unitType,
	string stringToParse,
	out double value,
	out string message
)

  • units
    The units formatting settings, typically obtained from Document.GetUnits().
  • unitType
    The target unit type for the value.
  • String
    stringToParse
    The string to parse.
  • Double%
    value
    The parsed value, in Revit's internal units. Ignore this value if the function returns false.
  • String%
    message
    A localized message that, if the parsing fails, explains the reason for failure.
Return Value bool True if the string can be parsed, false otherwise.

Loading…