A few years ago, Eric Lippert blogged on the hypothetical info operator, which allows you to get information about a method / properties at compile time, rather than at run time. Basically saying that it is a good pony, but not a unicorn ....
I read a little about the ability of Rosyln to rewrite code at compile time, how difficult would it be to implement information using Roslyn?
EDIT: I thought this might be a way to get everything Eric said, what you were thinking about, but I should have broken functions a bit if it werenโt.
- Get the name of the property.
- Get the type of property.
- Get accessors properties.
- Get the name of the method.
- Get everything he had in mind with infoof ...
In refactoring mode, which is checked at compile time. For me personally, 1 covers about 90% of what I would use (the new subscriber information attribute to get the name of the caller can actually cover about 60%, but, of course, if there was a method that worked both inside and outside the method which would be preferable).
jmoreno Jun 29 2018-12-12T00: 00Z
source share