Table of Contents

DotEnvSerializerOptions Class

Definition

Namespace
Bodu.Text.DotEnv
Assembly
Bodu.Text.DotEnv.dll
Package
Bodu.Text.DotEnv 1.0.0
Source
DotEnvSerializerOptions.cs

Provides configuration for DotEnvSerializer, controlling property naming, case sensitivity, field inclusion, null handling, and the export prefix on the write path.

public sealed class DotEnvSerializerOptions
Inheritance
DotEnvSerializerOptions
Inherited Members
Extension Methods

Remarks

An options instance becomes read-only the first time it is used for serialization or deserialization; mutating a property after that point throws InvalidOperationException. Share and reuse a configured instance rather than allocating one per call.

Constructors

DotEnvSerializerOptions()

Initializes a new instance of the DotEnvSerializerOptions class with general-purpose defaults.

public DotEnvSerializerOptions()

DotEnvSerializerOptions(DotEnvSerializerDefaults)

Initializes a new instance of the DotEnvSerializerOptions class from the specified defaults.

public DotEnvSerializerOptions(DotEnvSerializerDefaults defaults)

Parameters

defaults DotEnvSerializerDefaults

The defaults to initialize from.

Properties

Default

Gets the shared read-only default options.

public static DotEnvSerializerOptions Default { get; }

Property Value

DotEnvSerializerOptions

The default options.

DefaultIgnoreCondition

Gets or sets the condition under which a property is omitted from the output.

public IgnoreCondition DefaultIgnoreCondition { get; set; }

Property Value

IgnoreCondition

The default ignore condition.

Exceptions

InvalidOperationException

Thrown when set after the options have become read-only.

IncludeFields

Gets or sets a value indicating whether public fields participate in serialization in addition to properties.

public bool IncludeFields { get; set; }

Property Value

bool

true to include fields; otherwise false.

Exceptions

InvalidOperationException

Thrown when set after the options have become read-only.

IsReadOnly

Gets a value indicating whether the options have become read-only.

public bool IsReadOnly { get; }

Property Value

bool

true once the options have been used; otherwise false.

PropertyNameCaseInsensitive

Gets or sets a value indicating whether property-name matching on deserialization ignores case.

public bool PropertyNameCaseInsensitive { get; set; }

Property Value

bool

true to match case-insensitively; otherwise false.

Exceptions

InvalidOperationException

Thrown when set after the options have become read-only.

PropertyNamingPolicy

Gets or sets the naming policy applied to property names, or null to use names verbatim.

public NamingPolicy? PropertyNamingPolicy { get; set; }

Property Value

NamingPolicy

The property naming policy.

Exceptions

InvalidOperationException

Thrown when set after the options have become read-only.

WriteExportPrefix

Gets or sets a value indicating whether written keys are prefixed with the export keyword.

public bool WriteExportPrefix { get; set; }

Property Value

bool

true to write an export prefix; otherwise false.

Exceptions

InvalidOperationException

Thrown when set after the options have become read-only.

Applies to

ProductVersions
.NET8, 10