jeudi 31 mars 2016

Create generic type template from string

I have the following piece of generic code.

var base_generic_type = typeof(ConsumerService<,>);

I'd really like to be able to use a string to create this type for example

var base_generic_type = Type.GetType(serviceTypeName, true);

But I can't quite figure out the syntax for creating the generic type template from a string.

I would be most grateful if someone could provide some pointers, all the generic type questions on StackOverflow I can find all start out knowing the basic template type.





Aucun commentaire:

Enregistrer un commentaire