Hi !
I have problem in such situation .
I have file  A.cs  wth classe  A and C :

using  System;
public  class   C   {
 int   p;
 public  C  ( int p )  {
  this.p = p;
 }
 public int  getP()  {  return ( p ); }
}
//////////////////////////////////////////////
class  A  {
 public static void  Main ( string[]  args ) {
  Console.WriteLine ( "Test" );
 }
 public void f ( C   c )  {
  Console.WriteLine ( "p = {0}", c.getP() );
 }
}
and file  DInvoke2.cs :

using  System;
using  System.Reflection;
public  class  C  {
 int    p;
 public  C  ( int p )  {
  this.p = p;
 }
 public int getP() { return ( p ); }
}
//////////////////////////////////////////////
class  DInvoke2  {
 public static void  Main ( string[]  args ) {
  Assembly  asm      = Assembly.LoadFrom ( "A.exe" );
  Type      Aclass   = asm.GetType ( "A" );
  MethodInfo fMethod = Aclass.GetMethod ( "f" );
  object    Aobj     = Activator.CreateInstance ( Aclass );
  Console.WriteLine ( "... Dynamically Invoking" );
  object[]  argobjs = new object [ 1 ];
  argobjs [ 0 ] = new C ( 1000 );
  fMethod.Invoke ( Aobj,
                             argobjs  );
 }
}
but after invoking the  function   f
I have received  a Reflection.Invoke  ArgumentException .
I have using  Mono Release 0.16 under RedHat.

YS.



_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to