Skip to content

Convert Byte of Array into Object

July 5, 2010

Precondition :
I want to convert byte of array into a Object.

Description:
I want to build a function that receive a byte of array parameter and return an object.

Code:
function Object ConvertByteArrayToObject (byte[] receiver)
{
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
ms.Write(receiver, 0, receiver.Length);
ms.Seek(0, 0);
Object _sender= bf.Deserialize(ms);
ms.Close();
}

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.