views:

3770

answers:

1

I am working with LINQ to SQL and my image fields are treated as Binary. It's no big issue to convert the Binary type to byte[] (you can just use the ToArray() method of the Binary object) when I need to render the images, but can someone tell me how to turn either a byte[] or Stream object into the Binary object so I can save it back to the database.

+10  A: 

You can use the constructor:

public Binary(byte[] value)

like this:

yourObj.BinaryProperty = new Binary(bytes);
Panos
heh, well that's simple enough. Thank you.
Colin