AnsweredAssumed Answered

Trying to iterate over attributes and check for bad point references.

Question asked by BrianFONeil on Oct 10, 2016
Latest reply on Oct 10, 2016 by rdavin

I am trying to loop over the attributes in a PI AF database, and set them to Excluded if they do not point to a valid PI Point.


I have this block of code, which makes the decision for an attribute, and wonder if there would be a more performant way to do it?


    string Point = subElement.Attributes[i].DataReference.PIPoint.Name;
    if (subElement.Attributes[i].IsExcluded)
        subElement.Attributes[i].IsExcluded = false;
catch (System.Exception exception)
    subElement.Attributes[i].IsExcluded = true;


As may be consensus, running a Try Catch over every attribute may be causing slow performance of this code.




Message was edited by: Rick Davin.  Added C# syntax highlighting.