[Mono-dev] Detect List<> from C code

Joachim Ante joe at unity3d.com
Sat Jun 20 08:24:52 EDT 2009


Hi,

Whats the best way of checking if a MonoField* refers to a  
System.Generic.Container.List<>? The check needs to be high performance.


For non-generic classes I usually do:

MonoClass* myCachedPtrToSomeClass = mono_class_from_name(...);

....

MonoClass* klass = mono_class_from_mono_type(mono_field_get_type 
(field));
if (myCachedPtrToSomeClass == compareClass)
	;

Joachim Ante


More information about the Mono-devel-list mailing list