AnsweredAssumed Answered

AFAttributes.ToArray() changed?

Question asked by dskogman on Feb 26, 2019
Latest reply on Aug 16, 2019 by andrew_Inwood

I'm going thru the Developing Application with the PI AF SDK and when I try to load the attributes in a list box I get the following error:

 

Error CS1929 'AFAttributes' does not contain a definition for 'ToArray' and the best extension method overload 'Enumerable.ToArray<AFAttributes>(IEnumerable<AFAttributes>)' requires a receiver of type 'IEnumerable<AFAttributes>' AF App C:\Users\kad8743\source\repos\AF App\AF App\Form1.cs 44 Active

 

private void afTreeView1_AfterSelect(object sender, TreeViewEventArgs e)

        {

            AFElement selectedElement = afTreeView1.AFSelection as AFElement;

            lbAttributes.Items.Clear();

            if( selectedElement != null)

            {

                lbAttributes.Items.AddRange(selectedElement.Attributes.ToArray<AFAttributes>());

            }

        }

 

The SDK reference doesn't show a ToArray method either. Has something changed or am I doing something wrong?

Outcomes