ערוך

שתף באמצעות


UTF8Encoding.TryGetBytes Method

Definition

Encodes into a span of bytes a set of characters from the specified read-only span if the destination is large enough.

public:
 override bool TryGetBytes(ReadOnlySpan<char> chars, Span<System::Byte> bytes, [Runtime::InteropServices::Out] int % bytesWritten);
public override bool TryGetBytes (ReadOnlySpan<char> chars, Span<byte> bytes, out int bytesWritten);
override this.TryGetBytes : ReadOnlySpan<char> * Span<byte> * int -> bool
Public Overrides Function TryGetBytes (chars As ReadOnlySpan(Of Char), bytes As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

Parameters

chars
ReadOnlySpan<Char>

The span containing the set of characters to encode.

bytes
Span<Byte>

The byte span to hold the encoded bytes.

bytesWritten
Int32

Upon successful completion of the operation, the number of bytes encoded into bytes.

Returns

true if all of the characters were encoded into the destination; false if the destination was too small to contain all the encoded bytes.

Applies to