4
Answers

Passing bytearray by ref in C#

Hassan farrukh

Hassan farrukh

13y
17.5k
1
The input that i have is a byte array containing bytes of an image
 
e.g.
 
 
byte
[] byteData;
string
fileName = @"C:\pic3.jp2";
FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
long numBytes = new FileInfo(fileName).Length;
byteData = br.ReadBytes((
int)numBytes);
 
Now i have a control named j2k
 
and i want to use its function
 
j2k.OpenMemory() in order to get converted image in jp2 format
 
its parameters are
 
openmemory(ref byte src_byte,int src_length)
 
 
Now i have a byte array and the function wants me to send it a byte. How can i convert a bytearray into ref byte. I have tried using first element of byte array it got compiled but returned error in executing that line.
Answers (4)