Opc.Ua.Server.CoreNodeManager.FindLocalNodes C# (CSharp) Method

FindLocalNodes() public method

Returns all targets of the specified reference.
public FindLocalNodes ( NodeId sourceId, NodeId referenceTypeId, bool isInverse ) : NodeIdCollection
sourceId NodeId
referenceTypeId NodeId
isInverse bool
return NodeIdCollection
        public NodeIdCollection FindLocalNodes(NodeId sourceId, NodeId referenceTypeId, bool isInverse)
        {
            if (sourceId == null)        throw new ArgumentNullException("sourceId");
            if (referenceTypeId == null) throw new ArgumentNullException("referenceTypeId");

            try
            {
                m_lock.Enter();

                ILocalNode source = GetManagerHandle(sourceId) as ILocalNode;

                if (source == null)
                {
                    return null;
                }

                NodeIdCollection targets = new NodeIdCollection();
                
                foreach (IReference reference in source.References)
                {
                    if (reference.IsInverse != isInverse || !m_server.TypeTree.IsTypeOf(reference.ReferenceTypeId, referenceTypeId))
                    {
                        continue;
                    }

                    ExpandedNodeId targetId = reference.TargetId;

                    if (targetId.IsAbsolute)
                    {
                        continue;
                    }

                    targets.Add((NodeId)targetId);
                }
                    
                return targets;
            }
            finally
            {
                m_lock.Exit();
            } 
        }