This documentation is archived and is not being maintained.

Encoding.GetBytes Method (Char[])

.NET Framework 1.1

Encodes a specified character array into a byte array.

[Visual Basic]
Overloads Public Overridable Function GetBytes( _
   ByVal chars() As Char _
) As Byte()
public virtual byte[] GetBytes(
 char[] chars
public: virtual unsigned char GetBytes(
 __wchar_t chars __gc[]
)  __gc[];
public function GetBytes(
   chars : Char[]
) : Byte[];


The character array to encode.

Return Value

A byte array containing the encoded representation of chars.


Exception Type Condition
ArgumentNullException chars is a null reference (Nothing in Visual Basic).


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.GetBytes Overload List | GetByteCount | GetMaxByteCount | GetDecoder | GetEncoder