public static bool TryParse(
string? s,
BinarySizeOptions options,
NumberStyles style,
IFormatProvider? provider,
out BinarySize? result
)
Public Shared Function TryParse (
s As String,
options As BinarySizeOptions,
style As NumberStyles,
provider As IFormatProvider,
<OutAttribute> ByRef result As BinarySize
) As Boolean
public:
static bool TryParse(
String^ s,
BinarySizeOptions options,
NumberStyles style,
IFormatProvider^ provider,
[OutAttribute] BinarySize% result
)
static member TryParse :
s : string *
options : BinarySizeOptions *
style : NumberStyles *
provider : IFormatProvider *
result : BinarySize 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 the casing of the unit and any surrounding whitespace is ignored.
The size of 1 KiB always equals 1024 bytes, and 1 MiB is 1,048,576 bytes, and so on.
By default, this method also treats 1 KB as 1,024 bytes, identical to 1 KiB, and 1 MB equals 1 MiB equals 1,048,576 bytes, and so on.
When options includes the BinarySizeOptionsUseIecStandard flag, the SI prefixes (those without an 'i') are treated as powers of ten, so that 1 kB equals 1,000 bytes, 1 MB == 1,000,000 bytes, and so on. The IEC prefixes are unchanged, and remain based on powers of two.
The value of options is not stored in the instance, and will therefore not affect the output when converting back to a string. Use an appropriate format string with the ToString(String, IFormatProvider) method if you wish to use decimal prefixes there as well.
ArgumentException | options is not valid. |