PartitionTryParse(ReadOnlySpanChar, IFormatProvider, Partition) Method

Tries to parse a span of characters into a Partition class.

Definition

Namespace: Ookii.AnswerFile
Assembly: Ookii.AnswerFile (in Ookii.AnswerFile.dll) Version: 2.1.0+446b05628b4ec6933ca1b84b1f778ac43fb60ce9
C#
public static bool TryParse(
	ReadOnlySpan<char> s,
	IFormatProvider? provider,
	out Partition result
)

Parameters

s  ReadOnlySpanChar
The span of characters to parse.
provider  IFormatProvider
An object that provides culture-specific formatting information about s.
result  Partition
When this method returns, contains the result of successfully parsing s, or an undefined value on failure.

Return Value

Boolean
if s was successfully parsed; otherwise, .

Implements

ISpanParsableTSelfTryParse(ReadOnlySpanChar, IFormatProvider, TSelf)

Remarks

The input must use the format "size", "label:size", "size[fs]" or "label:size[fs]", where "label" is the volume label, "size" is a value using multiple-byte units, and "fs" is the name of a supported file system such as "FAT32" or "NTFS". Examples are "Windows:128GB" and "Data:16GB[FAT32]"

Instead of an explicit size, you can use "*" for the size to indicate the partition should be extended to fill the remaining space on the disk. For example, "Windows:*".

Certain volume labels are treated specially, and can be used to create special partition types. "System" creates a partition with PartitionTypeSystem, "MSR" with PartitionTypeMsr, and "WinRE" and "Recovery" with PartitionTypeUtility. This check is case insensitive, and all other volume labels create a partition with PartitionTypeNormal.

See Also