Answers for "c# byte array to string"

C#
18

c# string to byte array

string author = "Mahesh Chand";  
// Convert a C# string to a byte array  
byte[] bytes = Encoding.ASCII.GetBytes(author);  

// Convert a byte array to a C# string. 
string str = Encoding.ASCII.GetString(bytes);
Posted by: Guest on April-17-2020
7

convert system.byte a string c#

string result = System.Text.Encoding.UTF8.GetString(byteArray);
Posted by: Guest on July-03-2020
1

c# store byte array as string

public static void Main()
    {
        byte[] bytes = Encoding.Default.GetBytes("ABC123");
        Console.WriteLine("Byte Array is: " + String.Join(" ", bytes));
 
        string str = Encoding.Default.GetString(bytes);
        Console.WriteLine("The String is: " + str);
    }
Posted by: Guest on January-12-2021
7

c# byte array to string

var str = System.Text.Encoding.Default.GetString(result);
Posted by: Guest on August-19-2020
6

c# string to byte array

// Convert a string to a C# byte[]
//change encoding depending on your data
string someText = "some data as text.";
byte[] bytes = Encoding.ASCII.GetBytes(author);

// Convert a byte array to a C# string    
string str = Encoding.ASCII.GetString(bytes);  
Console.WriteLine(str);
Posted by: Guest on April-09-2020
1

convert bytes to string and back c#

string base64 = Convert.ToBase64String(bytes);
byte[] bytes = Convert.FromBase64String(base64);
Posted by: Guest on October-08-2020

C# Answers by Framework

Browse Popular Code Answers by Language