I have the following function (in a WCF)
Public Function GetPDF_Byte() As Byte Implements IService1.GetPDF_Byte
Dim fs As New FileStream("C:\My.pdf", FileMode.Open, FileAccess.Read)
Dim ImageData As Byte() = New Byte(fs.Length - 1) {}
fs.Read(ImageData, 0, System.Convert.ToInt32(fs.Length))
fs.Close()
Return ImageData
End Function
Problem is, I’m getting the following error on ‘Return ImageData’:
Value of type '1-dimensional array of Byte' cannot be converted to 'Byte'.
I’ve been playing with it, but can’t seem to figure out what I need to do to ImageData.
Function needs to return byte array:
So either the method in the interface and class is defined as
Byteand needs to be changed to byte array or it must be indeed byte and you need to return a single byte – which I really doubt as it is image data.