JsonNode(JsonNode) Constructor

DOM node constructor.

Definition

Namespace: MichaelBrooks.UK.Json
Assembly: JsonDOM (in JsonDOM.dll) Version: 1.0.7
C#
public JsonNode(
	JsonNode? parent
)

Parameters

parent  JsonNode
The parent node, or null if this is to be the root of the DOM / parse tree.

Remarks

Note that if this is not to be the root node of a new DOM (i.e. if parent is not null), even though the calling code has passed in parent, it is nevertheless still the caller's responsibility to add this node to the Children collection of the parent JsonNode, because only the calling code can know whether there is any significance to the order in which the children are arranged (see Children).

  Caution

If you pass a parent but fail to add this new node to the parent's Children collection, bad things will likely happen.

Note also that with this choice of constructor, any subsequent calls to this object's ItemString operator for a specifically named child node while multiple children exist with the specified name, will cause a JsonNodeDuplicateSiblingNameException.


Online page.

See Also