public static bool TryParse(
ReadOnlySpan<char> s,
out UBinarySize result
)
Public Shared Function TryParse (
s As ReadOnlySpan(Of Char),
<OutAttribute> ByRef result As UBinarySize
) As Boolean
public:
static bool TryParse(
ReadOnlySpan<wchar_t> s,
[OutAttribute] UBinarySize% result
)
static member TryParse :
s : ReadOnlySpan<char> *
result : UBinarySize byref -> bool
The input must contain a number, followed by one of the following units: "B", "KB", "KiB", "MB", "MiB", "GB", "GiB", "TB", "TiB", "PB", "PiB", "EB", or "EiB". The "B" may be omitted, and any surrounding whitespace is ignored.
This method uses the definition that "1 KB" == 1024 bytes, identical to "1 KiB", and "1 MB" == "1 MiB" == 1048576 bytes, and so on. To use the IEC standard where SI prefixes are treated as powers of ten, use the TryParse(ReadOnlySpanChar, BinarySizeOptions, NumberStyles, IFormatProvider, UBinarySize) method.
The units listed above are the default, invariant units based on the English language. You can parse localized units by using the BinaryUnitInfo class with the TryParse(ReadOnlySpanChar, IFormatProvider, UBinarySize) method.
The case of the units in s is ignored by default. Use the BinaryUnitInfoCompareOptions property to customize how units are matched.