[Mono-list] Reflection bug or I am wrong ...

Gonzalo Paniagua Javier gonzalo@ximian.com
13 Nov 2002 11:53:36 +0100


El lun, 11-11-2002 a las 15:54, Yury Serdyuk escribió:
> 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 ); }
> > }
[...]
> >   MethodInfo fMethod = Aclass.GetMethod ( "f" );
> >   object    Aobj     = Activator.CreateInstance ( Aclass );

This Activator.CreateInstance calls C::.ctor (), which does not exists.
Either add a 'public C () {}' to class C or use other overload of
Actvator.CreateInstance () that takes input parameteres for the
constructor.

-Gonzalo