Convert byte array To Char - CSharp System

CSharp examples for System:Byte Array

Description

Convert byte array To Char

Demo Code

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as published
 *   by the Free Software Foundation; either version 2.1 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/
using System.Text;
using System;/*w  w  w.  j  ava 2 s  . c o m*/

public class Main{
        /// <summary>
        /// 
        /// </summary>
        /// <param name="charBuffer"></param>
        /// <param name="iBufferIndex"></param>
        /// <returns></returns>
        public static char ToChar( byte[] charBuffer, int iBufferIndex )
        {
            return BitConverter.ToChar( charBuffer, iBufferIndex );
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="charBuffer"></param>
        /// <returns></returns>
        public static char ToChar( byte[] charBuffer )
        {
            return BitConverter.ToChar( charBuffer, 0 );
        }
}

Related Tutorials