[Mono-list] Instantiating all classes from a namespace

Charlie Poole charlie at nunit.com
Sun Oct 5 17:02:54 EDT 2008


 Hi Chris,

> -----Original Message-----
> From: mono-list-bounces at lists.ximian.com 
> [mailto:mono-list-bounces at lists.ximian.com] On Behalf Of Chris Howie
> Sent: Sunday, October 05, 2008 1:17 PM
> To: Mono mailing list
> Subject: Re: [Mono-list] Instantiating all classes from a namespace
> 
> On Sun, Oct 5, 2008 at 1:58 PM, Charlie Poole 
> <charlie at nunit.com> wrote:
> > That doesn't instantiate them, which is much harder in general.
> >
> > Say a Type has only one consructor, which takes an object 
> of class A. 
> > Now you have to instantiate A. But maybe A ony has a constructor 
> > requiring a B... :-)
> >
> > Hopefully, the OP doesn't want to solve the most general 
> case, but has 
> > some specific limits he has not told us about yet.
> 
> In any case like this you create a contract that such classes 
> must have a specific constructor.  It is madness not to.

Yes, that would be an approach. Personally, I'd prefer an
interface as a marker (or a custom attribute) with the absence
of a proper constructor treated as an error - it seems less
prone to accidentally including a class.

Charlie

> --
> Chris Howie
> http://www.chrishowie.com
> http://en.wikipedia.org/wiki/User:Crazycomputers
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com 
> http://lists.ximian.com/mailman/listinfo/mono-list
> 





More information about the Mono-list mailing list