I'm new to C#.
Basically, I'm trying to convert an image with byte type from database into a readable image format (displaying the byte as an actual Image). I've wrote the following code, but don't know how to call the class method.
public Image byteArrayToImage(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
And, I'm calling it like below but it has red lines under byteArrayToImage(ImageData);
:
public Image Img = byteArrayToImage(ImageData);
Any idea how and why?