/// <summary> /// Adds a child to the current Music Object. If successful, <see cref="Parent"/> of the child will be updated. /// </summary> /// <param name="c">The child.</param> public void AddChild(MusicObject c) { if (c.Properties.ParentId == Id) { c.Parent ??= this; _children.Add(c); } else { throw new ArgumentException("The parent of the specified child isn't the current object."); } }
/// <summary> /// Sets the parent of the current Music Object. If successful, <see cref="Children"/> of the parent will be updated. /// </summary> /// <param name="o">The parent Music Object.</param> public void SetParent(MusicObject o) { if (o.Id == Properties.ParentId) { Parent = o; o.AddChild(this); } else { throw new ArgumentException("The parent of the current object isn't the specified object."); } }