[Mono-list] Adding missing Attributes to System.Web
Piers Haken
piersh@friskit.com
Wed, 12 Jun 2002 04:21:58 -0700
Unfortunately (AFAIK, it's been a while...) you can only get the Type of
an Attribute that's applied to a class (Type.GetCustomAttributes()), not
an instantiation of that attribute (Type vs. RuntimeType). I couldn't
find a way to get the value of a property from just a Type.
I may just be getting confused, initially when I tried doing this, I was
trying to get the property values of attributes on mono classes loaded
by the MS runtime. Apparently the MS runtime doesn't handle
instantiating a Type with the same name as a class that's already
loaded, even though it's from a different assembly. It probably should,
but I'm not surprised that case didn't get tested.
Piers.
-----Original Message-----
From: Nick Drochak [mailto:ndrochak@gol.com]
Sent: Wednesday, June 12, 2002 3:47 AM
To: Piers Haken
Cc: Mono-List
Subject: RE: [Mono-list] Adding missing Attributes to System.Web
| Extra credit goes to the person that can work out how to derive the
| parameters of an attribution via reflection (I don't think it can be
| done). In my book, this is a gap in the reflecction API.
|
| If you can, let me know how, and I'll add it to corcompare.
My thought was to recursively drill down the attribute's properties
(with
GetProperties(bindingFlags)) and get the values for the properties that
are "basic" types, i.e. ints, strings, etc.
Is this too naive?
Nick D.