Determining an auto property

70 views
Skip to first unread message

deedee

unread,
Aug 22, 2012, 1:09:43 PM8/22/12
to mono-...@googlegroups.com

Hi,

Is there a way to find from a property definition, if the property is Auto property? On looking at the dll, I can see the private string <OldValue>k__BackingField; generated for an auto property named 'OldValue' returning a string - under the Derived Types, but how do I fetch the corresponding information directly from Mono?

Thanks in advance :)

Jb Evain

unread,
Aug 22, 2012, 4:12:06 PM8/22/12
to mono-...@googlegroups.com
If both's getter and setter of the PropertDefinition have a
CompilerGeneratedAttribute on them, then it's probably a auto
property.
> --
> --
> mono-cecil

Simon

unread,
Aug 25, 2012, 7:49:03 PM8/25/12
to mono-...@googlegroups.com
what are you trying to achieve?

deedee

unread,
Sep 10, 2012, 3:42:10 PM9/10/12
to mono-...@googlegroups.com
Simon: I am doing some code analysis, and I want to exclude the auto - properties from that.

Jb Evain: I still have to try that out, other things have kept me busy -- but if that works, will update it here.

Thanks!

Simon

unread,
Sep 16, 2012, 5:46:44 AM9/16/12
to mono-...@googlegroups.com
deedee. 

As JB said there is no way to work this out via metadata. you have to make assumptions.

The easiest would be to take "<OldValue>k__BackingField" and extract the "OldValue" part and find a property with that name
Reply all
Reply to author
Forward
0 new messages