[mono-android] Activator.CreateInstance
Dave Goughnour
david.goughnour at elantech-inc.com
Thu Mar 24 22:13:56 EDT 2011
Thanks, that did the trick. Saved me lots of time. I was already looking at the code to figure out how to avoid using CreateInstance. Would not have been pretty...
Dave Goughnour
-----Original Message-----
From: monodroid-bounces at lists.ximian.com [mailto:monodroid-bounces at lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: Thursday, March 24, 2011 9:54 PM
To: monodroid at lists.ximian.com
Subject: Re: [mono-android] Activator.CreateInstance
On Mar 24, 2011, at 9:47 PM, Dave Goughnour wrote:
> I'm porting code that runs fine in .NET and am having problems with Activator.CreateInstance. I tried the version that takes in a type and calls the default constructor as well as the version that takes a type and an object[] of parameters and both complain that the method is not found but they both work fine in .NET. Any known issues with this?
You're missing a [Android.Runtime.PreserveAttribute] on your constructor.
My apologies, as we need to better document this, but Mono for Android is following the design of MonoTouch here:
http://monotouch.net/Documentation/API_Design#PreserveAttribute
- Jon
_______________________________________________
Monodroid mailing list
Monodroid at lists.ximian.com
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
More information about the Monodroid
mailing list