Yes, that's exactly it. When I apply the attribute onto the getter, I get the result as true. I suppose things are clear now.
Thanks! :) On Jul 25, 11:41 am, Jb Evain <[email protected]> wrote: > On Mon, Jul 25, 2011 at 7:31 PM, deedee <[email protected]> wrote: > > I think I will have to iterate through PropertyDefinition for the > > properties separately using typeDefinition.Properties. If I do that, I > > get the HasCustomAttribute true for property. > > Is that what you were doing too? > > If I retrieve the properties through TypeDefinition.Methods, I get > > get_Property and set_Property methods. But maybe since they do not > > have the custom attribute on these individual methods (but on the > > property as a whole), it returns false.. > > I see. > > Consider the following: > > [Foo] > public string Name { > [Bar] > get { return _name; } > > } > > The PropertyDefinition Name has one attribute Foo, the > MethodDefinition get_Name has one attribute Bar. > > A PropertyDefinition and a MethodDefinition are conceptually two > different entities. > > Jb > > Jb -- -- mono-cecil
