How to convert string to Byte array in c#

This is very simple code showing how to convert string to byte array in c#

# How to convert byte array to string in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Blog_CS
    class Program
        static void Main(string[] args)
            const string message = "the quick brown fox jump over the lazy dog";
            byte[] bytes = Encoding.Default.GetBytes(message);

        private static void Print(byte[] bytes)
            Console.WriteLine(String.Join(",", bytes));
Next Post Previous Post
No Comment
Add Comment
comment url