ActivateD
Expert Member
Hello guys, I have been teaching myself C# for the past 2 months and I have just gone into Input/Output section of C#. I am busy playing around with WriteAllBytes and the myFile.txt when I open it, it does not have the array I created but some unknown text. What am I doing wrong?
The result I get in myFile.txt is
Will I have to use Type-Conversion to make my array appear in myFile.txt?
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
byte[] myByteArray = new byte[]
{
10,
20,
30,
40,
50
};
File.WriteAllBytes("myfile.txt", myByteArray);
Console.ReadKey();
}
}
}
The result I get in myFile.txt is
Code:
üyM
Will I have to use Type-Conversion to make my array appear in myFile.txt?