Opc.Ua.Server.CustomNodeManager2.DeleteNode C# (CSharp) Method

DeleteNode() public method

Deletes a node and all of its children.
public DeleteNode ( ServerSystemContext context, Opc.Ua.NodeId nodeId ) : bool
context ServerSystemContext
nodeId Opc.Ua.NodeId
return bool
        public bool DeleteNode(
            ServerSystemContext context,
            NodeId nodeId)
        {
            ServerSystemContext contextToUse = m_systemContext.Copy(context);

            bool found = false;
            List<LocalReference> referencesToRemove = new List<LocalReference>();

            lock (Lock)
            {
                if (m_predefinedNodes == null)
                {
                    return false;
                }

                NodeState node = null;

                if (PredefinedNodes.TryGetValue(nodeId, out node))
                {
                    RemovePredefinedNode(contextToUse, node, referencesToRemove);
                    found = true;
                }

                RemoveRootNotifier(node);
            }

            // must release the lock before removing cross references to other node managers.
            if (referencesToRemove.Count > 0)
            {
                Server.NodeManager.RemoveReferences(referencesToRemove);
            }

            return found;
        }
        #endregion
CustomNodeManager2