YamlValue Class
Definition
Represents a scalar node in a mutable YAML document object model.
public sealed class YamlValue : YamlNode
- Inheritance
-
YamlValue
- Inherited Members
- Extension Methods
Properties
ValueKind
Gets the kind of the scalar value.
public YamlValueKind ValueKind { get; }
Property Value
- YamlValueKind
The value kind.
Methods
Create(bool)
Creates a boolean scalar.
public static YamlValue Create(bool value)
Parameters
valueboolThe boolean value.
Returns
- YamlValue
The scalar node.
Create(double)
Creates a floating-point scalar.
public static YamlValue Create(double value)
Parameters
valuedoubleThe floating-point value.
Returns
- YamlValue
The scalar node.
Create(long)
Creates an integer scalar.
public static YamlValue Create(long value)
Parameters
valuelongThe integer value.
Returns
- YamlValue
The scalar node.
Create(string)
Creates a string scalar.
public static YamlValue Create(string value)
Parameters
valuestringThe string value.
Returns
- YamlValue
The scalar node.
GetValue<T>()
Gets the scalar value converted to the requested type.
public T GetValue<T>()
Returns
- T
The converted value.
Type Parameters
TThe desired value type.
Exceptions
- InvalidOperationException
The value cannot be converted to
T.
WriteTo(Utf8YamlWriter)
Writes this node to the given writer.
public override void WriteTo(Utf8YamlWriter writer)
Parameters
writerUtf8YamlWriterThe writer to emit into.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |