C# UnicodeEncoding GetChars(Byte[])

Description

UnicodeEncoding GetChars(Byte[]) When overridden in a derived class, decodes all the bytes in the specified byte array into a set of characters.

Syntax

UnicodeEncoding.GetChars(Byte[]) has the following syntax.


public virtual char[] GetChars(
  byte[] bytes
)

Parameters

UnicodeEncoding.GetChars(Byte[]) has the following parameters.

  • bytes - The byte array containing the sequence of bytes to decode.

Returns

UnicodeEncoding.GetChars(Byte[]) method returns

Example


using System;/*from  ww  w .  j a  v  a 2 s  .c  om*/
using System.Text;

public class SamplesEncoding
{

    public static void Main()
    {
        Encoding enc = Encoding.GetEncoding("utf-32");

        char[] chars = enc.GetChars(new byte[]{1,2,3});
        Console.WriteLine(chars);

    }

}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding