[Mono-list] Method Attributes
Hamza Karamali
karamal@eecg.toronto.edu
Mon, 18 Aug 2003 10:24:47 -0400 (EDT)
> Message: 6
> From: "Andreas Nahr" <ClassDevelopment@A-SoftTech.com>
> To: <mono-list@lists.ximian.com>
> Subject: [Mono-list] Method Attributes
> Date: Mon, 18 Aug 2003 13:10:57 +0200
> Organization: A - Soft Technologies
> > If I attach a custom attribute called "myAttribute" to a certain =
> method,
> > how can I check in Mono (while the method is being compiled) whether a
> > method has this attribute? Is there a function that will search the
> > metadata for the attribute if I pass it the name of the attribute? If
> > not, how would I go about doing this?
> >=20
>
> Just call:
>
> TypeDescriptor.GetAttributes(TheObjectThatShouldBeTested)
>
> and check for the attribute in the result AttributeCollection
> (Please note that this function may not be completed 100% in Mono right =
> now)
>
> Andreas
Thanks for the info. However, I want to do this within the mono C code
(I'm a Master's student trying to hack mono for research) -- not from C#.
While I am compiling a method (in mini_method_compile, for example), I'd
like to check the method attributes by referencing its metadata directly.
Is there any easy way to do this in mono? Or do I have to read the CLI
specs and then use the functions in metadata.c in an appropriate manner?
Hamza.