Share via


GetBytes Method (String, Int32, Int32, Byte[], Int32)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

When overridden in a derived class, encodes a set of characters from the specified string into the specified byte array.

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

Syntax

'Declaration
Public Overridable Function GetBytes ( _
    s As String, _
    charIndex As Integer, _
    charCount As Integer, _
    bytes As Byte(), _
    byteIndex As Integer _
) As Integer
public virtual int GetBytes(
    string s,
    int charIndex,
    int charCount,
    byte[] bytes,
    int byteIndex
)
public:
virtual int GetBytes(
    String^ s, 
    int charIndex, 
    int charCount, 
    array<unsigned char>^ bytes, 
    int byteIndex
)
abstract GetBytes : 
        s:string * 
        charIndex:int * 
        charCount:int * 
        bytes:byte[] * 
        byteIndex:int -> int 
override GetBytes : 
        s:string * 
        charIndex:int * 
        charCount:int * 
        bytes:byte[] * 
        byteIndex:int -> int 
public function GetBytes(
    s : String, 
    charIndex : int, 
    charCount : int, 
    bytes : byte[], 
    byteIndex : int
) : int

Parameters

  • bytes
    Type: array<System. . :: . .Byte> [] () [] []
    The byte array to contain the resulting sequence of bytes.
  • byteIndex
    Type: System. . :: . .Int32
    The index at which to start writing the resulting sequence of bytes.

Return Value

Type: System. . :: . .Int32
The actual number of bytes written into bytes.

Remarks

If the data to be converted is available only in sequential blocks (such as data read from a stream) or if the amount of data is so large that it needs to be divided into smaller blocks, the application should use the Decoder or the Encoder provided by the GetDecoder method or the GetEncoder method, respectively, of a derived class.

.NET Framework Security

See Also

Reference

Encoding Class

GetBytes Overload

System.Text Namespace