Below is a sample code snippet demonstrating the conversion of Byte Array to string in C#.
How to Convert Byte Array to String in C#?
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(); }
you can use System.Text.Encoding.Unicode.GetBytes() to retrieve the set of bytes that Microsoft.Net would using to represent the characters.
Using UTF8 conversion
byte[] bArray = Encoding.UTF8.GetBytes (inputString);