Прочетете на английски Редактиране

Споделяне чрез


Version.TryFormat Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

TryFormat(Span<Char>, Int32, Int32)

Tries to format this version instance into a span of characters.

TryFormat(Span<Byte>, Int32, Int32)

Tries to format this version instance into a span of bytes.

TryFormat(Span<Char>, Int32)

Tries to format this version instance into a span of characters.

TryFormat(Span<Byte>, Int32)

Tries to format this version instance into a span of bytes.

TryFormat(Span<Char>, Int32, Int32)

Source:
Version.cs
Source:
Version.cs
Source:
Version.cs

Tries to format this version instance into a span of characters.

C#
public bool TryFormat(Span<char> destination, int fieldCount, out int charsWritten);

Parameters

destination
Span<Char>

The span in which to write this instance's value formatted as a span of characters.

fieldCount
Int32

The number of components to return. This value ranges from 0 to 4.

charsWritten
Int32

When this method returns, contains the number of characters that were written in destination.

Returns

true if the formatting was successful; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1

TryFormat(Span<Byte>, Int32, Int32)

Source:
Version.cs
Source:
Version.cs

Tries to format this version instance into a span of bytes.

C#
public bool TryFormat(Span<byte> utf8Destination, int fieldCount, out int bytesWritten);

Parameters

utf8Destination
Span<Byte>

The span in which to write this instance's value formatted as a span of UTF-8 bytes.

fieldCount
Int32

The number of components to return. This value ranges from 0 to 4.

bytesWritten
Int32

When this method returns, contains the number of bytes that were written in utf8Destination.

Returns

true if the formatting was successful; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET 8, 9, 10

TryFormat(Span<Char>, Int32)

Source:
Version.cs
Source:
Version.cs
Source:
Version.cs

Tries to format this version instance into a span of characters.

C#
public bool TryFormat(Span<char> destination, out int charsWritten);

Parameters

destination
Span<Char>

The span in which to write this instance's value formatted as a span of characters.

charsWritten
Int32

When this method returns, contains the number of characters that were written in destination.

Returns

true if the formatting was successful; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1

TryFormat(Span<Byte>, Int32)

Source:
Version.cs
Source:
Version.cs

Tries to format this version instance into a span of bytes.

C#
public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten);

Parameters

utf8Destination
Span<Byte>

The span in which to write this instance's value formatted as a span of UTF-8 bytes.

bytesWritten
Int32

When this method returns, contains the number of bytes that were written in utf8Destination.

Returns

true if the formatting was successful; otherwise, false.

Applies to

.NET 10 и други версии
Продукт Версии
.NET 8, 9, 10