DotEnvReaderOptions Struct
Definition
Provides configuration for a Utf8DotEnvReader, controlling how the reader interprets optional DotEnv syntax conventions.
public readonly struct DotEnvReaderOptions
- Inherited Members
- Extension Methods
Remarks
The options are an immutable value type; assign the init-only properties through an object initializer and read Default for the standard behavior.
Properties
Default
Gets the default reader options: the export prefix, inline comments, and comment preservation are all
enabled.
public static DotEnvReaderOptions Default { get; }
Property Value
- DotEnvReaderOptions
The default options.
DisallowExportPrefix
Gets a value indicating whether a leading export keyword before a key is left unrecognized rather than
stripped.
public bool DisallowExportPrefix { get; init; }
Property Value
- bool
true to leave the prefix unrecognized, so that an entry written with it is malformed; otherwise false, which strips it.
Remarks
The property is inverted so the parameterless Default enables the prefix.
DisallowInlineComments
Gets a value indicating whether a # preceded by whitespace is read as part of an unquoted value rather
than as the start of an inline comment.
public bool DisallowInlineComments { get; init; }
Property Value
Remarks
The property is inverted so the parameterless Default enables inline comments. It does not affect a comment after a closing quote, which is allowed either way.
SkipComments
Gets a value indicating whether comment lines are skipped rather than surfaced as Comment tokens.
public bool SkipComments { get; init; }
Property Value
Remarks
The property is inverted so the parameterless Default preserves comments.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |