UTF8Encoding.TryGetBytes 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.
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.
- 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.