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.

DistanceListGetEnumerator Method

Gets an enumerator for enumeraring through the list.

Namespace:  Tekla.Structures.Datatype
Assembly:  Tekla.Structures.Datatype (in Tekla.Structures.Datatype.dll) Version: 2019.0.0.0 (2019.0.0.0)
Syntax
public IEnumerator<Distance> GetEnumerator()

Return Value

Type: IEnumeratorDistance
The list enumerator.

Implements

IEnumerableTGetEnumerator
Examples
This example shows how to enumerate the Distance instances in a DistanceList.
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);

        // In this example, GetEnumerator is not explicitly called, 
        // but it is implemented to support the use of foreach.
        foreach(Distance distance in distanceList)
        {
            string formattedDistance = distance.ToString();
        }

        // Indexed access is also supported. This allows the list to be enumerated in
        // any order required.
        for(int i = 0; i < distanceList.Count; i++)
        {
            string formattedDistance = distanceList[i].ToString();
        }
    }
}
See Also