[mono-android] System.Attribute for Activity class methods
Jonathan Pryor
jonp at xamarin.com
Tue Jun 26 16:03:43 UTC 2012
On Jun 20, 2012, at 7:12 AM, Sellec wrote:
> Hi all. Is System.Attribute and custom attributes work in Mono for android?
I thought so...
I'm not entirely sure I understand your question/scenario. When/where exactly would you expect the breakpoint within the LayoutTestAttribute constructor to be hit? Attribute instances won't be created unless you call GetCustomAttributes() somewhere, and your code doesn't call GetCustomAttributes anywhere. Try this:
foreach (LayoutTestAttribute attr in typeof(Activity1).GetMethod("TestMethod").GetCustomAttributes (typeof(LayoutTestAttribute), true)) {
// do something with attr
}
- Jon
More information about the Monodroid
mailing list