arraysegment byte to string c# code example

Example 1: convert system.byte a string c#

string result = System.Text.Encoding.UTF8.GetString(byteArray);

Example 2: string from byte array c#

var str = System.Text.Encoding.Default.GetString(result);

Example 3: c# char array to string

using System;
using System.Text;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] char_arr = { 'H', 'e', 'l', 'l', 'o'};

            //converting char[] to string
            string str = new string(char_arr);

            //printing string
            Console.WriteLine("str = " + str);

            //hit ENTER to exit
            Console.ReadLine();
        }
    }
}

Example 4: C# array to string

string.Join(",", Client);