Hi,
I am trying to invoke a method from a COM dll using InvokeMember which
has the following signature:
int GetStatus(ref byte[] scannedBytes, System.Int32 length);
However when I try and call this method using a byte[] parameter, I get
a type mismatch error.
The code that I am using here is:
byte[] scannedBytes = GetData(); // Internally returns a byte array
Type type = Assembly.LoadFrom("Interop.Scanner.dll").GetType() ;
object obj = Activator.CreateInstance(type);
object[] args = new object[]{scannedBytes,scannedBytes.length);
ParameterModifier[] mods = new ParameterModifier[2];
bool[] byref = {true,false};
for (int i = 0; i < 2; i++)
{
ParameterModifier m = new ParameterModifier(1);
m[0] = byRef[i];
mods[i] = m;
}
This is the line I am getting "type mismatch" exception.
int result =
type.InvokeMember("GetStatus",BindingFlags.InvokeM ethod,null,obj,args,mo
ds,null,new string[]{"scannedBytes","length"});
Can some one please tell me what am I doing wrong.
Thanks,
George
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!