Axiom.Core.Node.RemoveFromParent C# (CSharp) Method

RemoveFromParent() public method

Removes the node from parent node if any
public RemoveFromParent ( ) : void
return void
		public void RemoveFromParent()
		{
			if ( parent != null )
				parent.RemoveChild( name );//if this errors, then the parent is out of sync with the child
		}

Usage Example

Beispiel #1
0
		/// <summary>
		///    Adds a node to the list of children of this node.
		/// </summary>
		public void AddChild( Node child )
		{
			string childName = child.Name;
			if ( child == this )
				throw new ArgumentException( string.Format( "Node '{0}' cannot be added as a child of itself.", childName ) );
			if ( childNodes.ContainsKey( childName ) )
				throw new ArgumentException( string.Format( "Node '{0}' already has a child node with the name '{1}'.", this.name, childName ) );

			child.RemoveFromParent();
			childNodes.Add( childName, child );

			child.NotifyOfNewParent( this );
		}