TomlFormatHelper Class
Helper methods to format values into TOML-compliant strings.
public static class TomlFormatHelperMethods
| Name | Description |
|---|---|
| ToString(TomlDateTime) | Converts a TomlDateTime to its TOML representation. |
| ToString(bool) | Converts a boolean to its TOML representation. |
| ToString(byte, TomlPropertyDisplayKind) | Converts an 8-bit unsigned integer to its TOML representation. |
| ToString(DateOnly, TomlPropertyDisplayKind) | Converts a DateOnly to its TOML representation. |
| ToString(DateTime, TomlPropertyDisplayKind) | Converts a DateTime to its TOML representation. |
| ToString(DateTimeOffset, TomlPropertyDisplayKind) | Converts a DateTimeOffset to its TOML representation. |
| ToString(double) | Converts a double-precision floating point value to its TOML representation. |
| ToString(short, TomlPropertyDisplayKind) | Converts a 16-bit signed integer to its TOML representation. |
| ToString(int, TomlPropertyDisplayKind) | Converts a 32-bit integer to its TOML representation. |
| ToString(long, TomlPropertyDisplayKind) | Converts a 64-bit integer to its TOML representation. |
| ToString(sbyte, TomlPropertyDisplayKind) | Converts an 8-bit signed integer to its TOML representation. |
| ToString(float) | Converts a single-precision floating point value to its TOML representation. |
| ToString(string, TomlPropertyDisplayKind) | Converts a string to its TOML representation using the provided display kind. |
| ToString(TimeOnly, TomlPropertyDisplayKind) | Converts a TimeOnly to its TOML representation. |
| ToString(ushort, TomlPropertyDisplayKind) | Converts a 16-bit unsigned integer to its TOML representation. |
| ToString(uint, TomlPropertyDisplayKind) | Converts an unsigned 32-bit integer to its TOML representation. |
| ToString(ulong, TomlPropertyDisplayKind) | Converts an unsigned 64-bit integer to its TOML representation. |
ToString overloads
ToString(TomlDateTime)
TomlFormatHelper.csConverts a TomlDateTime to its TOML representation.
public static string ToString(TomlDateTime tomlDateTime)ToString(bool)
TomlFormatHelper.csToString(byte, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts an 8-bit unsigned integer to its TOML representation.
public static string ToString(byte u8, TomlPropertyDisplayKind displayKind)Parameters
u8byte- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(DateOnly, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a DateOnly to its TOML representation.
public static string ToString(DateOnly dateOnly, TomlPropertyDisplayKind displayKind)Parameters
dateOnlyDateOnly- The date value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(DateTime, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a DateTime to its TOML representation.
public static string ToString(DateTime dateTime, TomlPropertyDisplayKind displayKind)Parameters
dateTimeDateTime- The date/time value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
Exceptions
TomlException- A local value near
DateTime.MinValueorDateTime.MaxValueis out of range once converted to UTC.
ToString(DateTimeOffset, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a DateTimeOffset to its TOML representation.
public static string ToString(DateTimeOffset dateTimeOffset, TomlPropertyDisplayKind displayKind)Parameters
dateTimeOffsetDateTimeOffset- The date/time value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(double)
TomlFormatHelper.csToString(short, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a 16-bit signed integer to its TOML representation.
public static string ToString(short i16, TomlPropertyDisplayKind displayKind)Parameters
i16short- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(int, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a 32-bit integer to its TOML representation.
public static string ToString(int i32, TomlPropertyDisplayKind displayKind)Parameters
i32int- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(long, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a 64-bit integer to its TOML representation.
public static string ToString(long i64, TomlPropertyDisplayKind displayKind)Parameters
i64long- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(sbyte, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts an 8-bit signed integer to its TOML representation.
public static string ToString(sbyte i8, TomlPropertyDisplayKind displayKind)Parameters
i8sbyte- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(float)
TomlFormatHelper.csToString(string, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a string to its TOML representation using the provided display kind.
public static string ToString(string s, TomlPropertyDisplayKind displayKind)Parameters
sstring- The string value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
Exceptions
TomlException- The string contains an unpaired surrogate, which TOML cannot represent.
ToString(TimeOnly, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a TimeOnly to its TOML representation.
public static string ToString(TimeOnly timeOnly, TomlPropertyDisplayKind displayKind)Parameters
timeOnlyTimeOnly- The time value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(ushort, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts a 16-bit unsigned integer to its TOML representation.
public static string ToString(ushort u16, TomlPropertyDisplayKind displayKind)Parameters
u16ushort- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(uint, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts an unsigned 32-bit integer to its TOML representation.
public static string ToString(uint u32, TomlPropertyDisplayKind displayKind)Parameters
u32uint- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
ToString(ulong, TomlPropertyDisplayKind)
TomlFormatHelper.csConverts an unsigned 64-bit integer to its TOML representation.
public static string ToString(ulong u64, TomlPropertyDisplayKind displayKind)Parameters
u64ulong- The integer value.
displayKindTomlPropertyDisplayKind- The display kind.
Returns
string The TOML string.
Exceptions
TomlException- The value is greater than
Int64.MaxValue, the largest TOML integer.