[Mono-list] Mono Embedding: How can I use a Generic Class from mscorlib.dll
Robert Jordan
robertj at gmx.net
Mon Mar 23 16:04:57 UTC 2015
On 23.03.2015 15:13, LinWuxiang wrote:
> Hello everybody.
>
> How can I instantiate a generic type, like List<String> from mscorlib?
>
> I thought I should use “mono_class_from_generic_parameter”, but not sure
> how to use this function.
There used to be no embedding APIs for this in the past, and it
doesn't look that this was changed.
You can achieve this by mono_runtime_invoke()-ing
System.Type.MakeGenericType (see MSDN).
Note that System.Type is represented by MonoReflectionType*
in the embedding world. You can get the MonoReflectionType*
of a MonoType* with mono_type_get_object().
You can get back the MonoType* of a MonoReflectionType* with
mono_reflection_type_get_type().
Robert
More information about the Mono-list
mailing list