Show / Hide Table of Contents

    PbArray<T>.GetEnumerator() Method

    .NET Standard 2.x

    Returns an enumerator that iterates through PbArray<T>.

    Namespace: PowerScript.Bridge

    Assembly: PowerScript.Bridge.dll

    Syntax

    public IEnumerator<T> GetEnumerator();
    

    Returns

    System.Collections.Generic.IEnumerator<T>

    An enumerator that iterates through PbArray<T>.

    Examples

    The following code example demonstrates how to use the GetEnumerator method to return an enumerator object and get the data of the enumerator object.

    using System;
    using PowerScript.Bridge;
    
    namespace Appeon.ApiDoc.PbArrayExamples
    {
        public class GetEnumeratorExample
        {
            public void Example()
            {
                // Creates a PbArray object which is the int type and has no fixed size
                PbArray<int> pbArray = new PbArray<int>();
    
                // Adds data PbArray
                pbArray.Add(1);
                pbArray.Add(2);
                pbArray.Add(3);
    
                var enumerator = pbArray.GetEnumerator();
    
                while (enumerator.MoveNext())
                {
                    Console.WriteLine(enumerator.Current);
                }
    
                /*This code produces the following output:
                
                1
                2
                3
                */
            }
        }
    }
    

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon