Encoder.Convert Method (Char*, Int32, Byte*, Int32, Boolean, Int32%, Int32%, Boolean%)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

This member can be used only by trusted applications. If you try to use this member in a partial-trust application, your code will throw a MethodAccessException exception. This member is security-critical, which restricts its use.

[SECURITY CRITICAL]

Converts a buffer of Unicode characters to an encoded byte sequence and stores the result in another buffer.

This API is not CLS-compliant. The CLS-compliant alternative is Convert(array<Char[], Int32, Int32, array<Byte[], Int32, Int32, Boolean, Int32%, Int32%, Boolean%).

Namespace:  System.Text
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
<CLSCompliantAttribute(False)> _
<SecurityCriticalAttribute> _
<ComVisibleAttribute(False)> _
Public Overridable Sub Convert ( _
    chars As Char*, _
    charCount As Integer, _
    bytes As Byte*, _
    byteCount As Integer, _
    flush As Boolean, _
    <OutAttribute> ByRef charsUsed As Integer, _
    <OutAttribute> ByRef bytesUsed As Integer, _
    <OutAttribute> ByRef completed As Boolean _
)
[CLSCompliantAttribute(false)]
[SecurityCriticalAttribute]
[ComVisibleAttribute(false)]
public virtual void Convert(
    char* chars,
    int charCount,
    byte* bytes,
    int byteCount,
    bool flush,
    out int charsUsed,
    out int bytesUsed,
    out bool completed
)

Parameters

  • chars
    Type: System.Char*
    The address of a string of UTF-16 encoded characters to convert.
  • charCount
    Type: System.Int32
    The number of characters in chars to convert.
  • bytes
    Type: System.Byte*
    The address of a buffer to store the converted bytes.
  • byteCount
    Type: System.Int32
    The maximum number of bytes in bytes to use in the conversion.
  • flush
    Type: System.Boolean
    true to indicate no further data is to be converted; otherwise, false.
  • charsUsed
    Type: System.Int32%
    When this method returns, contains the number of characters from chars that were used in the conversion. This parameter is passed uninitialized.
  • bytesUsed
    Type: System.Int32%
    When this method returns, contains the number of bytes that were used in the conversion. This parameter is passed uninitialized.
  • completed
    Type: System.Boolean%
    When this method returns, contains true if all the characters specified by charCount were converted; otherwise, false. This parameter is passed uninitialized.

Version Information

Silverlight

Supported in: 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.