StringConverters

Namespace: SnowBank.Runtime.Converters · class

Helper methods for converting common types into string literals

Methods

CountDigits

static int CountDigits(long value)

static int CountDigits(ulong value)

static int CountDigits(short value)

static int CountDigits(ushort value)

static int CountDigits(int value)

static int CountDigits(uint value)

ParseDateTime

static DateTime ParseDateTime(string date)

Parses a string literal with any compatible format into a DateTime ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse

Returns: Corresponding DateTime value if successful

static DateTime ParseDateTime(string date, CultureInfo culture)

Parses a string literal with any compatible format into a DateTime ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse
  • culture — Optional culture provider

Returns: Corresponding DateTime value if successful

static DateTime ParseDateTime(string date, DateTime defaultValue)

Parses a string literal with any compatible format into a DateTime ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse
  • defaultValue — Default value if null, empty, or malformed

Returns: Corresponding DateTime value if successful; otherwise, defaultValue

static DateTime ParseDateTime(string date, DateTime defaultValue, CultureInfo culture)

Parses a string literal with any compatible format into a DateTime ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse
  • defaultValue — Default value if null, empty, or malformed
  • culture — Optional culture provider

Returns: Corresponding DateTime value if successful; otherwise, defaultValue

ParseTime

static TimeOnly ParseTime(string time)

Converts a string literal containing a "human friendly" representation into a TimeOnly, for example "11","11h","11h00","11:00" -> {11:00:00.000}

  • time — String to parse

Returns: Corresponding TimeOnly value.

ToBoolean

static bool? ToBoolean(string value)

Converts a string literal into its boolean equivalent, using relaxed rules

  • value — Literal containing either a "truthy" or "falsy" boolean (ex: "true", "on", "1" vs "false", "off", "0", ...)

Returns: Corresponding boolean value if it matches the set of recognized tokens; otherwise, null.

The recognized "truthy" literals are: "true", "yes", "on", "1".

The recognized "falsy" literals are: "false", "no", "off", "0".

The null and empty strings will return null.

StringConverters.ToBoolean("true", false) == true
StringConverters.ToBoolean("false", true) == false
StringConverters.ToBoolean("hello", false) == false

static bool ToBoolean(string value, bool defaultValue)

Converts a string literal into a boolean, using relaxed rules

  • value — Literal containing either a "truthy" or "falsy" boolean (ex: "true", "on", "1" vs "false", "off", "0", ...)
  • defaultValue — Default value, if the string is empty or not recognized

Returns: Corresponding boolean value if it matches the set of recognized tokens; otherwise, defaultValue.

The recognized "truthy" literals are: "true", "yes", "on", "1".

The recognized "falsy" literals are: "false", "no", "off", "0", the null or empty string.

ToDateString

static string ToDateString(DateTime date)

Converts the date component of a DateTime value into a string literal with format YYYYMMDD

  • date — Date to format

Returns: Formated date of length 8, with format YYYYMMDD

ToDateTime

static DateTime? ToDateTime(string value, CultureInfo provider = null)

Converts a string literal into its DateTime equivalent

  • value — Literal to convert (ex: "2025-05-27T16:17:89.456")
  • provider — Optional Format provider

Returns: Corresponding DateTime, or null if it could not be decoded

static DateTime ToDateTime(string value, DateTime defaultValue, CultureInfo provider = null)

Converts a string literal into its DateTime equivalent

  • value — Literal to convert (ex: "2025-05-27T16:17:89.456")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid date
  • provider — Optional Format provider

ToDateTimeString

static string ToDateTimeString(DateTime date)

Converts a DateTime value into a string literal with format YYYYMMDDHHMMSS

  • date — Date to format

Returns: Formated date of length 14, with format YYYYMMDDHHMMSS

static string ToDateTimeString(Instant date)

Converts a Instant value into a string literal with format YYYYMMDDHHMMSS

  • date — Date to format

Returns: Formated date of length 14, with format YYYYMMDDHHMMSS

static string ToDateTimeString(ZonedDateTime date)

Converts a ZonedDateTime value into a string literal with format YYYYMMDDHHMMSS

  • date — Date to format

Returns: Formated date of length 14, with format YYYYMMDDHHMMSS

ToDecimal

static decimal? ToDecimal(string value, IFormatProvider provider = null)

Converts a string literal into its 128-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0", "123.456e7")
  • provider — Optional Format provider

Returns: Corresponding single value, or null if it could not be decoded

static decimal ToDecimal(string value, decimal defaultValue, IFormatProvider provider = null)

Converts a string literal into its 128-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0", "123.456e7")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid decimal number
  • provider — Optional Format provider

Returns: Corresponding decimal value, or defaultValue if it could not be decoded

ToDouble

static double? ToDouble(string value)

Converts a string literal into its 64-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")

Returns: Corresponding double value, or null if it could not be decoded

StringConverters.ToDouble("1.23") => 1.23d
StringConverters.ToDouble("hello") => null
StringConverters.ToDouble("NaN") => double.NaN
StringConverters.ToDouble("∞") => double.PositiveInfinity
StringConverters.ToDouble("-∞") => double.NegativeInfinity

static double? ToDouble(ReadOnlySpan<char> value)

Converts a string literal into its 64-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")

Returns: Corresponding double value, or null if it could not be decoded

StringConverters.ToDouble("1.23") => 1.23d
StringConverters.ToDouble("hello") => null
StringConverters.ToDouble("NaN") => double.NaN
StringConverters.ToDouble("∞") => double.PositiveInfinity
StringConverters.ToDouble("-∞") => double.NegativeInfinity

static double ToDouble(string value, double defaultValue, IFormatProvider provider = null)

Converts a string literal into its 64-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid decimal number
  • provider — Optional Format provider

Returns: Corresponding double value, or defaultValue if it could not be decoded

StringConverters.ToDouble("1.23", 0) => 1.23d
StringConverters.ToDouble("hello", 0) => 0
StringConverters.ToDouble("NaN", 0) => double.NaN
StringConverters.ToDouble("∞", 0) => double.PositiveInfinity
StringConverters.ToDouble("-∞", 0) => double.NegativeInfinity

static double ToDouble(ReadOnlySpan<char> value, double defaultValue, IFormatProvider provider = null)

Converts a string literal into its 64-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid decimal number
  • provider — Optional Format provider

Returns: Corresponding double value, or defaultValue if it could not be decoded

StringConverters.ToDouble("1.23", 0) => 1.23d
StringConverters.ToDouble("hello", 0) => 0
StringConverters.ToDouble("NaN", 0) => double.NaN
StringConverters.ToDouble("∞", 0) => double.PositiveInfinity
StringConverters.ToDouble("-∞", 0) => double.NegativeInfinity

ToEnum

static TEnum? ToEnum<TEnum>(string value)

Converts a string literal into its TEnum enum equivalent

  • value — Literal to convert (ex: "Red", "2", ...)

Returns: Corresponding TEnum, or null if it could not be decoded

static TEnum ToEnum<TEnum>(string value, TEnum defaultValue)

Converts a string literal into its TEnum enum equivalent

  • value — Literal to convert (ex: "Red", "2", ...)
  • defaultValue — Fallback value returned if the string literal is empty or invalid

Returns: Corresponding TEnum, or defaultValue if it could not be decoded

ToGuid

static Guid? ToGuid(string value)

Converts a string literal into its Guid equivalent

  • value — Literal to convert (ex: "01234567-89AB-CDEF-0123-456789ABCDEF")

Returns: Corresponding Guid, or null if it could not be decoded

static Guid ToGuid(string value, Guid defaultValue)

Converts a string literal into its Guid equivalent

  • value — Literal to convert (ex: "01234567-89AB-CDEF-0123-456789ABCDEF")
  • defaultValue — Fallback value returned if the string literal is empty or invalid

Returns: Corresponding Guid, or defaultValue if it could not be decoded

ToInstant

static Instant? ToInstant(string value, CultureInfo provider = null)

Converts a string literal into its Instant equivalent

  • value — Literal to convert (ex: "2025-05-27T16:17:89.456")
  • provider — Optional Format provider

Returns: Corresponding Instant, or null if it could not be decoded

static Instant ToInstant(string value, Instant defaultValue, CultureInfo provider = null)

Converts a string literal into its Instant equivalent

  • value — Literal to convert (ex: "2025-05-27T16:17:89.456")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid date
  • provider — Optional Format provider

Returns: Corresponding Instant, or defaultValue if it could not be decoded

ToInt32

static int? ToInt32(string value)

Converts a string literal into its 32-bit signed integer equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1234" or "-5")

Returns: Corresponding integer value, or null if it could not be decoded

StringConverters.ToInt32("1234") == 1234
StringConverters.ToInt32("hello") == null

static int? ToInt32(ReadOnlySpan<char> value)

Converts a string literal into its 32-bit signed integer equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1234" or "-5")

Returns: Corresponding integer value, or null if it could not be decoded

StringConverters.ToInt32("1234") == 1234
StringConverters.ToInt32("hello") == null

static int ToInt32(string value, int defaultValue)

Converts a string literal into its 32-bit signed integer equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1234" or "-5")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid integer

Returns: Corresponding integer value, or defaultValue if it could not be decoded

StringConverters.ToInt32("1234", 0) == 1234
StringConverters.ToInt32("hello", 0) == 0

static int ToInt32(ReadOnlySpan<char> value, int defaultValue)

Converts a string literal into its 32-bit signed integer equivalent, using invariant-culture format

  • value — string literal to convert (ex: "1234" or "-5")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid integer

Returns: Corresponding integer value, or defaultValue if it could not be decoded

StringConverters.ToInt32("1234", 0) == 1234
StringConverters.ToInt32("hello", 0) == 0

ToInt64

static long? ToInt64(string value)

Converts a string literal into its 64-bit signed integer equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1234" or "-5")

Returns: Corresponding integer value, or null if it could not be decoded

StringConverters.ToInt64("1234") == 1234
StringConverters.ToInt64("hello") == null

static long? ToInt64(ReadOnlySpan<char> value)

Converts a string literal into its 64-bit signed integer equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1234" or "-5")

Returns: Corresponding integer value, or null if it could not be decoded

StringConverters.ToInt64("1234") == 1234
StringConverters.ToInt64("hello") == null

static long ToInt64(string value, long defaultValue)

Converts a string literal into its 64-bit signed integer equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1234" or "-5")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid integer

Returns: Corresponding integer value, or defaultValue if it could not be decoded

StringConverters.ToInt64("1234", 0) == 1234
StringConverters.ToInt64("hello", 0) == 0

static long ToInt64(ReadOnlySpan<char> value, long defaultValue)

Converts a string literal into its 64-bit signed integer equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1234" or "-5")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid integer

Returns: Corresponding integer value, or defaultValue if it could not be decoded

StringConverters.ToInt64("1234", 0) == 1234
StringConverters.ToInt64("hello", 0) == 0

ToSingle

static float? ToSingle(string value)

Converts a string literal into its 32-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")

Returns: Corresponding single value, or null if it could not be decoded

StringConverters.ToSingle("1.23") => 1.23d
StringConverters.ToSingle("hello") => null
StringConverters.ToSingle("NaN") => float.NaN
StringConverters.ToSingle("∞") => float.PositiveInfinity
StringConverters.ToSingle("-∞") => float.NegativeInfinity

static float? ToSingle(ReadOnlySpan<char> value)

Converts a string literal into its 32-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")

Returns: Corresponding single value, or null if it could not be decoded

StringConverters.ToSingle("1.23") => 1.23d
StringConverters.ToSingle("hello") => null
StringConverters.ToSingle("NaN") => float.NaN
StringConverters.ToSingle("∞") => float.PositiveInfinity
StringConverters.ToSingle("-∞") => float.NegativeInfinity

static float ToSingle(string value, float defaultValue, IFormatProvider provider = null)

Converts a string literal into its 32-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid decimal number
  • provider — Optional Format provider

Returns: Corresponding single value, or defaultValue if it could not be decoded

StringConverters.ToSingle("1.23", 0) => 1.23d
StringConverters.ToSingle("hello", 0) => 0
StringConverters.ToSingle("NaN", 0) => float.NaN
StringConverters.ToSingle("∞", 0) => float.PositiveInfinity
StringConverters.ToSingle("-∞", 0) => float.NegativeInfinity

static float ToSingle(ReadOnlySpan<char> value, float defaultValue, IFormatProvider provider = null)

Converts a string literal into its 32-bit floating-point number equivalent, using invariant-culture format

  • value — Literal to convert (ex: "1.0" or "123" or "123.456e7")
  • defaultValue — Fallback value returned if the string literal is empty or not a valid decimal number
  • provider — Optional Format provider

Returns: Corresponding single value, or defaultValue if it could not be decoded

StringConverters.ToSingle("1.23", 0) => 1.23d
StringConverters.ToSingle("hello", 0) => 0
StringConverters.ToSingle("NaN", 0) => float.NaN
StringConverters.ToSingle("∞", 0) => float.PositiveInfinity
StringConverters.ToSingle("-∞", 0) => float.NegativeInfinity

ToString

static string ToString(sbyte value)

Converts a 16-bit signed integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(byte value)

Converts a 16-bit unsigned integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(short value)

Converts a 16-bit signed integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(ushort value)

Converts a 16-bit unsigned integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(int value)

Converts a 32-bit signed integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(uint value)

Converts a 32-bit unsigned integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(long value)

Converts a 64-bit signed integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(ulong value)

Converts a 64-bit unsigned integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(Int128 value)

Converts a 64-bit signed integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(UInt128 value)

Converts a 64-bit unsigned integer into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(float value)

Converts a 32-bit IEEE floating point number into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(double value)

Converts a 64-bit IEEE floating point number into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(decimal value)

Converts a 64-bit IEEE floating point number into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(Half value)

Converts a 16-bit IEEE floating point number into a decimal string literal, using the Invariant culture

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(DateTime value)

Writes the text representation of a DateTime using the ISO 8601 format

  • value — Value to convert

Returns: Corresponding string literal

static string ToString(DateTimeOffset value)

Writes the text representation of a DateTimeOffset using the ISO 8601 format

  • value — Value to convert

Returns: Corresponding string literal

ToTimeString

static string ToTimeString(DateTime date)

Converts the time component of a DateTime value into a string literal with format HHMMSS

  • date — Time to format

Returns: Formated time of length 6, with format HHMMSS

TryParseDateTime

static bool TryParseDateTime(string date, CultureInfo culture, out DateTime result, bool throwsFail)

Attempts to parse a string literal with any compatible format into a DateTime ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse
  • culture — Optional culture provider
  • result — Receives the parsed DateTime, if successful.
  • throwsFail — If false, catch any parsing exception; otherwise, let them bubble up.

Returns: true if the operation was successful; otherwise, false

static bool TryParseDateTime(ReadOnlySpan<char> date, CultureInfo culture, out DateTime result, bool throwsFail)

Attempts to parse a string literal with any compatible format into a DateTime ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse
  • culture — Optional culture provider
  • result — Receives the parsed DateTime, if successful.
  • throwsFail — If false, catch any parsing exception; otherwise, let them bubble up.

Returns: true if the operation was successful; otherwise, false

TryParseInstant

static bool TryParseInstant(string date, CultureInfo culture, out Instant result, bool throwsFail)

Attempts to parse a string literal with any compatible format into a Instant ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse
  • culture — Optional culture provider
  • result — Receives the parsed Instant, if successful.
  • throwsFail — If false, catch any parsing exception; otherwise, let them bubble up.

Returns: true if the operation was successful; otherwise, false

static bool TryParseInstant(ReadOnlySpan<char> date, CultureInfo culture, out Instant result, bool throwsFail)

Attempts to parse a string literal with any compatible format into a Instant ("YYYY", "YYYYMM", "YYYYMMDD", "YYYY-MM-DD", "YYYYMMDDHHMMSS", or "YYYY-MM-DDTHH:MM:SS")

  • date — String literal to parse
  • culture — Optional culture provider
  • result — Receives the parsed Instant, if successful.
  • throwsFail — If false, catch any parsing exception; otherwise, let them bubble up.

Returns: true if the operation was successful; otherwise, false

WriteTo

static void WriteTo(TextWriter output, sbyte value)

Writes the text representation of a 16-bit signed integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, byte value)

Writes the text representation of a 16-bit unsigned integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, short value)

Writes the text representation of a 16-bit signed integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, ushort value)

Writes the text representation of a 16-bit unsigned integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, int value)

Writes the text representation of a 32-bit signed integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, uint value)

Writes the text representation of a 32-bit unsigned integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, long value)

Writes the text representation of a 64-bit signed integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, ulong value)

Writes the text representation of a 64-bit unsigned integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, Int128 value)

Writes the text representation of a 64-bit signed integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, UInt128 value)

Writes the text representation of a 64-bit unsigned integer, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, float value)

Writes the text representation of a 32-bit IEEE floating point number, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, double value)

Writes the text representation of a 64-bit IEEE floating point number, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, decimal value)

Writes the text representation of a 128-bit decimal floating point number, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, Half value)

Writes the text representation of a 16-bit IEEE floating point number, using the Invariant culture

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, DateTime value)

Writes the text representation of a DateTime using the ISO 8601 format

  • output — Destination
  • value — Value to write

static void WriteTo(TextWriter output, DateTimeOffset value)

Writes the text representation of a DateTimeOffset using the ISO 8601 format

  • output — Destination
  • value — Value to write

Fields

Base10MaxCapacityDecimal

const int Base10MaxCapacityDecimal

Maximum number of characters required to safely format any 128-bit decimal floating point number in base 10

This the value used by the runtime in Number.TryFormatDouble(...)

Base10MaxCapacityDouble

const int Base10MaxCapacityDouble

Maximum number of characters required to safely format any 64-bit IEEE floating point number in base 10

This the value used by the runtime in Number.TryFormatDouble(...)

Base10MaxCapacityHalf

const int Base10MaxCapacityHalf

Maximum number of characters required to safely format any 16-bit IEEE floating point number in base 10

This the value used by the runtime in Number.TryFormatDouble(...)

Base10MaxCapacityInt128

const int Base10MaxCapacityInt128

Maximum number of characters required to safely format any signed 64-bit integer in base 10

needs 40 characters in base 10 (including the negative sign)

Base10MaxCapacityInt16

const int Base10MaxCapacityInt16

Maximum number of characters required to safely format any signed 16-bit integer in base 10

needs 6 characters in base 10 (including the negative sign)

Base10MaxCapacityInt32

const int Base10MaxCapacityInt32

Maximum number of characters required to safely format any signed 32-bit integer in base 10

needs 11 characters in base 10 (including the negative sign)

Base10MaxCapacityInt64

const int Base10MaxCapacityInt64

Maximum number of characters required to safely format any signed 64-bit integer in base 10

needs 20 characters in base 10 (including the negative sign)

Base10MaxCapacityInt8

const int Base10MaxCapacityInt8

Maximum number of characters required to safely format any signed 8-bit integer in base 10

needs 4 characters in base 10 (including the negative sign)

Base10MaxCapacitySingle

const int Base10MaxCapacitySingle

Maximum number of characters required to safely format any 32-bit IEEE floating point number in base 10

This the value used by the runtime in Number.TryFormatDouble(...)

Base10MaxCapacityUInt128

const int Base10MaxCapacityUInt128

Maximum number of characters required to safely format any unsigned 64-bit integer in base 10

needs 39 characters in base 10

Base10MaxCapacityUInt16

const int Base10MaxCapacityUInt16

Maximum number of characters required to safely format any unsigned 16-bit integer in base 10

needs 5 characters in base 10

Base10MaxCapacityUInt32

const int Base10MaxCapacityUInt32

Maximum number of characters required to safely format any unsigned 32-bit integer in base 10

needs 10 characters in base 10

Base10MaxCapacityUInt64

const int Base10MaxCapacityUInt64

Maximum number of characters required to safely format any unsigned 64-bit integer in base 10

needs 20 characters in base 10

Base10MaxCapacityUInt8

const int Base10MaxCapacityUInt8

Maximum number of characters required to safely format any unsigned 8-bit integer in base 10

needs 3 characters in base 10

Base16MaxCapacityGuid

const int Base16MaxCapacityGuid

Maximum number of characters required to safely format any 128-bit using the standard format

"ffffffff-ffff-ffff-ffff-ffffffffffff" requires 36 characters

Base16MaxCapacityUuid128

const int Base16MaxCapacityUuid128

Maximum number of characters required to safely format any 128-bit using the standard format

"ffffffff-ffff-ffff-ffff-ffffffffffff" requires 36 characters

Base16MaxCapacityUuid64

const int Base16MaxCapacityUuid64

Maximum number of characters required to safely format any 64-bit using the standard format

"ffffffff-ffffffff" requires 17 characters