TomlValue Class
A mutable TOML value: a string, a number, a boolean, or a date or a time.
public abstract class TomlValue : TomlNode, IEquatable<TomlValue>Remarks
A value keeps the .NET type it is created from, such as Int32 or Single, and TomlValue.GetValue converts it to another compatible type. Values are equal when they are the same TOML value.
- Inheritance
TomlNodeTomlValue- Implements
Properties
| Name | Description |
|---|---|
| Value | Gets the value as it is stored. |
Value
Methods
| Name | Description |
|---|---|
| Create(TomlDateTime) | Creates a date or time value. |
| Create(bool) | Creates a boolean value. |
| Create(DateOnly) | Creates a local date value. |
| Create(DateTime) | Creates a date-time value: an offset date-time for a UTC or local DateTime, and a local date-time otherwise. |
| Create(DateTimeOffset) | Creates an offset date-time value. |
| Create(decimal) | Creates a float value, written with all the digits of the Decimal. |
| Create(double) | Creates a float value. |
| Create(int) | Creates an integer value. |
| Create(long) | Creates an integer value. |
| Create(float) | Creates a float value, written with the shortest text that reads back as the same Single. |
| Create(string) | Creates a string value. |
| Create(TimeOnly) | Creates a local time value. |
| Create<T>(T) | Creates a value of any type, which TomlSerializer writes with its converter, such as a Guid or an enum. |
| Equals(TomlValue?) | Indicates whether the current object is equal to another object of the same type. |
| Equals(object?) | Determines whether the specified object is equal to the current object. |
| GetHashCode() | Serves as the default hash function. |
| GetValue<T>() | Gets the value converted to T. |
| GetValueKind() | Gets the kind of the value. |
| ToString() | Gets the text of a string value, or the TOML text of the other values. |
| TryGetValue<T>(T) | Gets the value converted to T. |
| WriteTo(Utf8TomlWriter) | Writes the node with a writer: a table as key/value pairs and sub-tables where the writer expects a key, and as an inline table otherwise. |
Create overloads
Create(TomlDateTime)
TomlValue.csCreates a date or time value.
public static TomlValue Create(TomlDateTime value)Create(bool)
TomlValue.csCreate(DateOnly)
TomlValue.csCreate(DateTime)
TomlValue.csCreate(DateTimeOffset)
TomlValue.csCreates an offset date-time value.
public static TomlValue Create(DateTimeOffset value)Create(decimal)
TomlValue.csCreate(double)
TomlValue.csCreate(int)
TomlValue.csCreate(long)
TomlValue.csCreate(float)
TomlValue.csCreate(string)
TomlValue.csCreate(TimeOnly)
TomlValue.csCreate<T>(T)
TomlValue.csCreates a value of any type, which TomlSerializer writes with its converter, such as a Guid or an enum.
public static TomlValue Create<T>(T value) where T : notnullEquals overloads
Equals(TomlValue?)
TomlValue.csIndicates whether the current object is equal to another object of the same type.
Parameters
otherTomlValue?- An object to compare with this object.
Returns
bool true if the current object is equal to the other parameter; otherwise, false.
Equals(object?)
TomlValue.csGetHashCode()
TomlValue.csGetValue<T>()
TomlValue.csGets the value converted to T.
public new T GetValue<T>()GetValueKind()
TomlValue.csToString()
TomlValue.csTryGetValue<T>(T)
TomlValue.csWriteTo(Utf8TomlWriter)
TomlValue.csWrites the node with a writer: a table as key/value pairs and sub-tables where the writer expects a key, and as an inline table otherwise.
public override void WriteTo(Utf8TomlWriter writer)Parameters
writerUtf8TomlWriter- The writer.
Operators
| Name | Description |
|---|---|
| operator ==(TomlValue?, TomlValue?) | Compares two values. |
| operator !=(TomlValue?, TomlValue?) | Compares two values. |
operator ==(TomlValue?, TomlValue?)
TomlValue.csCompares two values.
operator !=(TomlValue?, TomlValue?)
TomlValue.csCompares two values.