Table of Contents

DotEnvNode Class

Definition

Namespace
Bodu.Text.DotEnv.Nodes
Assembly
Bodu.Text.DotEnv.dll
Package
Bodu.Text.DotEnv 1.0.0
Source
DotEnvNode.cs

Represents a node in a mutable DotEnv document tree. A DotEnv document is a flat, ordered object of string-valued keys, so the tree has exactly two concrete shapes: a DotEnvObject root and the DotEnvValue string leaves it contains.

public abstract class DotEnvNode
Inheritance
DotEnvNode
Derived
Inherited Members
Extension Methods

Properties

ValueKind

Gets the value kind of this node.

public abstract DotEnvValueKind ValueKind { get; }

Property Value

DotEnvValueKind

The node's DotEnvValueKind.

Methods

AsObject()

Returns this node as a DotEnvObject.

public DotEnvObject AsObject()

Returns

DotEnvObject

This node cast to DotEnvObject.

Exceptions

InvalidOperationException

Thrown when this node is not an object.

AsValue()

Returns this node as a DotEnvValue.

public DotEnvValue AsValue()

Returns

DotEnvValue

This node cast to DotEnvValue.

Exceptions

InvalidOperationException

Thrown when this node is not a value.

DeepClone()

Creates a deep copy of this node.

public abstract DotEnvNode DeepClone()

Returns

DotEnvNode

The cloned node.

Parse(ReadOnlySpan<byte>)

Parses the supplied UTF-8 bytes into a mutable DotEnv object tree.

public static DotEnvObject Parse(ReadOnlySpan<byte> utf8DotEnv)

Parameters

utf8DotEnv ReadOnlySpan<byte>

The DotEnv source bytes.

Returns

DotEnvObject

The parsed DotEnvObject root.

Exceptions

DotEnvFormatException

Thrown when the bytes are not valid DotEnv.

Parse(ReadOnlySpan<byte>, DotEnvReaderOptions)

Parses the supplied UTF-8 bytes into a mutable DotEnv object tree using the supplied reader options.

public static DotEnvObject Parse(ReadOnlySpan<byte> utf8DotEnv, DotEnvReaderOptions options)

Parameters

utf8DotEnv ReadOnlySpan<byte>

The DotEnv source bytes.

options DotEnvReaderOptions

The reader options.

Returns

DotEnvObject

The parsed DotEnvObject root.

Exceptions

DotEnvFormatException

Thrown when the bytes are not valid DotEnv.

Parse(string)

Parses the supplied DotEnv text into a mutable DotEnv object tree.

public static DotEnvObject Parse(string dotEnv)

Parameters

dotEnv string

The DotEnv source text.

Returns

DotEnvObject

The parsed DotEnvObject root.

Exceptions

ArgumentNullException

Thrown when dotEnv is null.

DotEnvFormatException

Thrown when the text is not valid DotEnv.

ToString()

Serializes this node to DotEnv text.

public override string ToString()

Returns

string

The DotEnv text.

ToUtf8Bytes()

Serializes this node to a new UTF-8 byte array.

public byte[] ToUtf8Bytes()

Returns

byte[]

The DotEnv bytes.

WriteTo(ref Utf8DotEnvWriter)

Writes this node's DotEnv representation to the supplied writer.

public abstract void WriteTo(ref Utf8DotEnvWriter writer)

Parameters

writer Utf8DotEnvWriter

The writer that receives the DotEnv bytes.

Operators

implicit operator DotEnvNode(string)

Converts a string to a DotEnvValue.

public static implicit operator DotEnvNode(string value)

Parameters

value string

The string value.

Returns

DotEnvNode

Applies to

ProductVersions
.NET8, 10