public void AddSibling(Person person) { Siblings ??= new List <Person>(); if (!Siblings.Contains(person)) { Siblings.Add(person); } else { throw new Exception("Sibling already present"); } }
public bool IsSiblingOf(Tree <TValue> tree) => Siblings.Contains(tree);
/// <summary> /// Determines if the node provided as the <paramref name="treeNode"/> is a sibling of this node. /// </summary> /// <param name="treeNode">The <see cref="ITreeNode{TId, T}"/> object that is being checked if it is a sibling of this object.</param> /// <returns>True if <paramref name="treeNode"/> is a sibling of this object, false if not</returns> public bool IsSibling(T treeNode) { return(Siblings.Contains(treeNode)); }