DistanceListParse Method (String, IFormatProvider) |
Parses a distance list from a string representation.
Namespace: Tekla.Structures.Datatype
Assembly: Tekla.Structures.Datatype (in Tekla.Structures.Datatype.dll) Version: 2023.0.3
Syntax
Parameters
- input
- Type: SystemString
The input string. - formatProvider
- Type: SystemIFormatProvider
The format provider.
Return Value
Type: DistanceListThe distance list.
Examples
This example shows how to override the format provider when parsing distance
lists. The Tekla Structures convention is to use a dot as the decimal separator
in all locales.
using Tekla.Structures.Datatype; using System.Globalization; public class Example { public void Example1() { // Current unit type controls the default unit type used in parsing. // The default unit is millimeter. Distance.CurrentUnitType = Distance.UnitType.Millimeter; // Tekla Structures uses dot as the decimal separator in all locales. // This will be parsed as 3 times 30.2 millimeters. DistanceList TeklaStructuresFormat = DistanceList.Parse("3*30.2", CultureInfo.InvariantCulture); // If the distance contains the unit, the distances are converted automatically. // This will be parsed as 3 times 30.2 meters. DistanceList distancesInMeters = DistanceList.Parse("3*30.2m", CultureInfo.InvariantCulture); } }
See Also