top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Convert Byte Array to String in C#?

0 votes
541 views
How to Convert Byte Array to String in C#?
posted May 24, 2016 by Latha

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes
using System;

using System.Collections.Generic;

using System.Data;

using System.Linq;

namespace AbundantCode

{

internal class Program

{

//How to Convert Byte Array to String in C# ?

private static void Main(string[] args)

{

string Input = "Welcome to Abundantcode.com";

Byte[] ByteOutput = ConvertStringToByte(Input);

string StringOutput = ConvertByteArrayToString(ByteOutput);

Console.WriteLine(StringOutput);

Console.ReadLine();

}

private static string ConvertByteArrayToString(Byte[] ByteOutput)

{

string StringOutput = System.Text.Encoding.UTF8.GetString(ByteOutput);

return StringOutput;

}

public static byte[] ConvertStringToByte(string Input)

{

return System.Text.Encoding.UTF8.GetBytes(Input);

}

}

}
answer May 24, 2016 by Shivaranjini
...