Opc.Ua.ServerTest.TestBase.CollectVariables C# (CSharp) Method

CollectVariables() private method

Recursively collects the child variables.
private CollectVariables ( INode parent, List variables ) : void
parent INode
variables List
return void
        private void CollectVariables(INode parent, List<VariableNode> variables)
        {
            VariableNode variable = parent as VariableNode;
            
            if (variable != null && ((variable.UserAccessLevel & AccessLevels.CurrentReadOrWrite) == AccessLevels.CurrentReadOrWrite))
            {
                bool found = false;

                for (int jj = 0; jj < variables.Count; jj++)
                {
                    if (Object.ReferenceEquals(variable, variables[jj]))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    variables.Add(variable);
                }
            }

            IList<INode> children = Session.NodeCache.Find(
                parent.NodeId,
                ReferenceTypeIds.HierarchicalReferences,
                false,
                true);

            for (int ii = 0; ii < children.Count; ii++)
            {
                CollectVariables(children[ii], variables);
            }
        }