API Reference

Detailed and full API reference helps you master Tekla development

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

DistanceFromDecimalString Method (String, IFormatProvider, DistanceUnitType)

Creates a distance from a decimal string representation.

Namespace:  Tekla.Structures.Datatype
Assembly:  Tekla.Structures.Datatype (in Tekla.Structures.Datatype.dll) Version: 2023.0.1
public static Distance FromDecimalString(
	string text,
	IFormatProvider formatProvider,
	DistanceUnitType unitType


Type: SystemString
The distance string.
Type: SystemIFormatProvider
The number format provider.
Type: Tekla.Structures.DatatypeDistanceUnitType
The unit type of the distance to parse.

Return Value

Type: Distance
The representation of the specified distance.
FormatExceptionThrown if the text does not represent a distance.
ArgumentExceptionThrown if an invalid unit type is specified.
This example shows how to specify a format provider and a unit type when parsing a Distance instance from a decimal string.
using Tekla.Structures.Datatype;
using System.Globalization;

public class Example
       public void Example1()
           Distance distance = Distance.FromDecimalString("3.2", CultureInfo.InvariantCulture, Distance.UnitType.Inch);
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.