[Mono-list] mono_runtime_invoke get returned array

fozzie david_aiken at yahoo.com
Fri Apr 24 16:01:41 EDT 2009


Thanks for you help.. managed to get something working

C# (in this case a property)
==============================

namespace my.namespace
{
        public myClass()
        {
                public string[] RetStrings
                {
                    get
                    {
                          // fill array
                    }
                }
        }
}

Unmanaged C++
============
    MonoClass* type = mono_class_from_name(image, "my.namespace",
"myClass");
    MonoProperty *prop = mono_class_get_property_from_name(type,
"RetStrings");
    MonoArray *assemblies = (MonoArray *)mono_property_get_value(prop,
pluginManagerInstance, NULL, &exc);
    if(!exc)
    {
        for (unsigned int i = 0; i < mono_array_length(assemblies); i++)
        {
            MonoString* s = mono_array_get(assemblies, MonoString*, i);
            char *s2 = mono_string_to_utf8(s);
            printf("s2: %s\n", s2);
        }
    }
    else
    {
        mono_print_unhandled_exception(exc);
    }


-- 
View this message in context: http://www.nabble.com/mono_runtime_invoke-get-returned-array-tp23223209p23223882.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list