public void ClearChildren(NodeChildrenType? newChildrenType = null) { m_ChildLines.Clear(); m_ChildNodes.Clear(); if (newChildrenType != null) ChildNodeType = (NodeChildrenType)newChildrenType; }
private void EnsureProperType(NodeChildrenType expectedType) { if (ChildNodeType != expectedType) { if (ChildNodes.Count == 0) ChildNodeType = expectedType; else throw new InvalidOperationException($"can't get child from this node. Expected type was {expectedType}, but node children are of type {ChildNodeType}"); } }
private void EnsureProperChildType(NodeChildrenType expectedType) { if (expectedType != NodeChildrenType.multiLineString && !this.Value.IsNullOrEmpty()) { throw new Exception($"node has a value ({Value}), which means it can't have children"); } if (ChildNodeType != expectedType) { if (ChildNodes.Count == 0) { ChildNodeType = expectedType; } else { throw new InvalidOperationException($"can't get child from this node. Expected type was {expectedType}, but node children are of type {ChildNodeType}"); } } }