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.

Meta.Microsoft.Help.Id
M:Tekla.Structures.Datatype.DistanceList.ToArray

DistanceListToArray Method

Copies the contents of the list into a new array.

Namespace:  Tekla.Structures.Datatype
Assembly:  Tekla.Structures.Datatype (in Tekla.Structures.Datatype.dll) Version: 2020.0.0.0 (2020.0.55582.0)
Syntax
public Distance[] ToArray()

Return Value

Type: Distance
The array of distances.
Examples
This example shows how to copy the Distance instances in a DistanceList to a new array.
using Tekla.Structures.Datatype;

public class Example
{
       public void Example1()
       {
           Distance[] distances = { new Distance(30.2), new Distance(2.3) };
           DistanceList distanceList = new DistanceList(distances);

           // We can copy the list contents to a new array. This allows us to
           // enumerate the contents even if the list changes during the enumeration.
           Distance[] distancesInArray = distanceList.ToArray();

           foreach(Distance distance in distancesInArray)
           {
               string formattedDistance = distance.ToString();
           }
       }
}
See Also