You cannot call the method with a ref parameter to any type other than
exactly the parameter type specified. The reasoning is pretty simple - suppose you could:
private void MyMethod(ref object o)
{
o = (object) new Point(10, 10);
}
...
byte[] data = new byte[1024];
MyMethod(ref data);
Console.WriteLine(data[100]);
What kind of output would you get? Apart from random and rubbish?
In order to call a method with a ref parameter, it must be an
assignable value, so try
byte[] myArray=new byte[20];
for(int i=0;i<20;i++)
myArray[i]=0;
object o = myArray;
myImage.GetLine(ref o, 10,10,20,10);
The method can then change the value of o without affecting the array in any way.