Export (0) Print
Expand All

Encoding.Convert Method (Encoding, Encoding, Byte[], Int32, Int32)

.NET Framework 1.1

Converts a range of bytes in a byte array from one encoding to another.

[Visual Basic]
Overloads Public Shared Function Convert( _
   ByVal srcEncoding As Encoding, _
   ByVal dstEncoding As Encoding, _
   ByVal bytes() As Byte, _
   ByVal index As Integer, _
   ByVal count As Integer _
) As Byte()
[C#]
public static byte[] Convert(
 Encoding srcEncoding,
 Encoding dstEncoding,
 byte[] bytes,
 int index,
 int count
);
[C++]
public: static unsigned char Convert(
 Encoding* srcEncoding,
 Encoding* dstEncoding,
 unsigned char bytes __gc[],
 int index,
 int count
)  __gc[];
[JScript]
public static function Convert(
   srcEncoding : Encoding,
 dstEncoding : Encoding,
 bytes : Byte[],
 index : int,
 count : int
) : Byte[];

Parameters

srcEncoding
The source of encoding.
dstEncoding
The destination of encoding.
bytes
The byte array to convert.
index
The starting index of the byte array to convert.
count
The number of bytes to convert.

Return Value

An array of type Byte containing the result of the conversion.

Exceptions

Exception Type Condition
ArgumentNullException srcEncoding, dstEncoding, or bytes arguments are a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException index and count do not denote a valid range in the byte array.

Remarks

This method converts count bytes at the starting index from srcEncoding to dstEncoding.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Encoding Class | Encoding Members | System.Text Namespace | Encoding.Convert Overload List

Show:
© 2014 Microsoft