Hi, i'm trying to convert a Byte[] to byte.

this is what i have, but it does not work

FileStream fsReport = new FileStream(reportPath, FileMode.Open, FileAccess.Read);

Byte[] bytBLOBData = new Byte[fsReport.Length];

fsReport.Read(bytBLOBData, 0, bytBLOBData.Length);


//Convert Byte[] to string

String temp = "";

--> I tried encoding with both ASCII and Unicode

//System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();

System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();

temp = enc.GetString(bytBLOBData);

//Convert String ToolBar byte



r.reportfile = Byte.Parse(temp);


catch (FormatException ex)




But then i get the message when attempting to execute the Byte.Parse(temp) : input string is not in the correct format.

Can anyone guide me into the right direction

Re: Visual C# General Convert a byte Array (Byte[]) to byte


The error you are getting suggests the value of temp cannot be converted to a byte

If memory servers a byte is between 0 and 255. If your string is not a number between or including these values that exception would occur.

You can't really turn a byte array into a byte as far as I am concerned.

A byte array would look like

3,54,215,3,7 etc.....

That would never be a valid byte object.