You are writing a LINQ to SQL repository application. An entity named ImageEntity maps a SQL column of type varbinary(max) to a Binary property named ImageData. You add the following method:

void WriteImage(ImageEntity imageEntity, string targetFilePath)
{
}

You need to provide an implementation that writes the ImageData property value to an image file.

What should you do?

 Posted by Rajkatie on 8/31/2012 | Category: ADO.NET Interview questions | Views: 1750 | Points: 40
Select from following answers:
  1. Add the following line of code to the method: File.WriteAllBytes(targetFilePath, imageEntity.ImageData.ToArray());
  2. Modify ImageEntity to implement ISerializable. Modify the method to call the BinaryFormatter to deserialize to the image file.
  3. Add the Serializable attribute to the ImageData property. Modify the method to call the BinaryFormatter to deserialize to the image file.
  4. All Above

Show Correct Answer


Source: MeasureUp.Com | | Alert Moderator 

Comments or Responses

Login to post response