Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Get getter and setter as methods or delegate

$
0
0

Hi,

Somewhere low-level, probably MSIL, each property's get and set accessors

string Text { get; set; }

resolve to a pair of methods:

string get_Text();
void  set_Text(string value);

afaik.

Is it possible to access these methods
as delegates in C# based on a
Linq-Lambda Expression such as:
"type => type.Text" or 2nd best a PropertyInfo?
Background is avoiding non-typesafe and probably slow
reflection based code that uses GetGetMethod and GetSetMethod
and Invoke respectively.

Thanks,
Chris


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>