Answers for "how to convert item of a list to byte array"

1

hwo to convert list of custom class to a byte

using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

byte[] bytes = null;
BinaryFormatter bf = new BinaryFormatter();
using (MemoryStream ms = new MemoryStream())
{
	//categoryList is where you put the list that you want to convert
    bf.Serialize(ms, categoryList);
    bytes = ms.ToArray();
}
Posted by: Guest on December-14-2020

Code answers related to "how to convert item of a list to byte array"

Browse Popular Code Answers by Language