[Mono-dev] Is property?

Greg Young gregoryyoung1 at gmail.com
Mon Jan 4 18:52:11 UTC 2016


Maybe explaining the use case a bit more is worthwhile. I am running
in the context of the profiling API. In many bits of code it is
prohibitively expensive (and not at all valuable) to look at
getters/setters. Even doing a hash lookup in them adds significant
overhead (think code that tends to use getters/setters for all field
access or code doing bunches of serialization).

I am looking for a way to fail fast on them, getting the name and
checking would be more expensive than the hash lookup.

On Mon, Jan 4, 2016 at 5:52 PM, Greg Young <gregoryyoung1 at gmail.com> wrote:
> Is there an easy way to test METHOD_ATTRIBUTE_SPECIAL_NAME for a MonoMethod *?
>
> On Mon, Jan 4, 2016 at 5:50 PM, Jb Evain <jbevain at gmail.com> wrote:
>> Hi Greg,
>>
>> I'm afraid there's no exact flag for that. The best approximation
>> would be to test that it is flagged METHOD_ATTRIBUTE_SPECIAL_NAME, and
>> that its name starts with "set_" or "get_".
>>
>> Short of that, you'll need to iterate over the properties of the class
>> and check that one of its methods points to your MonoMethod.
>>
>> Jb
>>
>>
>>
>> On Mon, Jan 4, 2016 at 4:36 AM, Greg Young <gregoryyoung1 at gmail.com> wrote:
>>> How can you figure out if a method is a property from a MonoMethod *?
>>>
>>> I have poked around looking for this for an hour or so and can't find it.
>>>
>>> Cheers,
>>>
>>> Greg
>>>
>>> --
>>> Studying for the Turing test
>>> _______________________________________________
>>> Mono-devel-list mailing list
>>> Mono-devel-list at lists.ximian.com
>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
> --
> Studying for the Turing test



-- 
Studying for the Turing test


More information about the Mono-devel-list mailing list