Re: Mono Embedding: How can I use a Generic Class from mscorlib.dll

Robert Jordan <[email protected]>
Newsgroups gmane.comp.gnome.mono.general
Message-ID <[email protected]>
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


_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.