EnumTEnumTryFormat(TEnum, SpanChar, Int32, EnumFormattingOptions, ReadOnlySpanChar) Method

Tries to format the value of the current TEnum instance into the provided span of characters.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0-preview.1
C#
public static bool TryFormat(
	TEnum value,
	Span<char> destination,
	out int charsWritten,
	EnumFormattingOptions format = EnumFormattingOptions.Auto,
	ReadOnlySpan<char> separator = default
)

Parameters

value  TEnum
A TEnum value to be formatted.
destination  SpanChar
The target span of characters of the formatted value.
charsWritten  Int32
When this method returns, the number of characters that were written in destination.
format  EnumFormattingOptions  (Optional)
The formatting options. This parameter is optional.
Default value: Auto.
separator  ReadOnlySpanChar  (Optional)
A span containing the separator in case of flags formatting. If empty, then comma-space (, ) separator is used. This parameter is optional.
Default value: Span<char>.Empty.

Return Value

Boolean
, if the formatting was successful; otherwise, .

See Also