I can't use that syntax since T is unknown until the framework's type system initializes.
This works var thingList = Activator.CreateInstance(typeof(List<>).MakeGenericType (ThingType)); qry.List(thingList as IList); I'm having other problems with dynamic types that I hope to post about when I get a clear example. On Jun 11, 5:43 pm, Fabio Maulo <[email protected]> wrote: > criteria.List(new YourList<T>()); > > 2009/6/11 darren <[email protected]> > > > > > > > I am trying to find a way to have the List method fill a generic list > > without using the List<T> signature. The lists I am using are generic > > typed lists but are created dynamically at runtime using reflection. > > > Here's a snippet > > > ICriteria cr = session.CreateCriteria(objType); > > var objList = Activator.CreateInstance(typeof(List<>).MakeGenericType > > (objType)) as IList; > > cr.List(objList); > > > This throws a type conversion exception in one of the ArrayHelper > > methods. > > > I'm trying to avoid having to do an extra array copy for every List > > call. > > -- > Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
