I'm contributing to a library called Fasterflect whose purpose is "improving the developer experience of using reflection". As such, it provides an abstraction built on top of classic reflection and would be used in exactly the same scenarios.
The following shows the current syntax for accessing members via an object instance:
obj.SetPropertyValue( "PropertyWithPrivateSetter", "foo" );
obj.SetFieldValue( "_readOnlyIntegerProperty", 123 );
One user has suggested that we add support for lamdba-based access (similar to Fluent Hibernate):
obj.SetPropertyValue<MyClass>( x => x.PropertyWithPrivateSetter, "foo" );
obj.SetFieldValue<MyClass>( x => x.ReadOnlyInteger, Access.CamelCaseField(Prefix.Underscore), 123 );
I'm having a hard time thinking of scenarios where this would be useful, given that reflection is usually performed on types that you do not know about at compile-time. Am I just lacking in imagination? Are there valid scenarios for reflection where you know the type at compile-time?
There is some additional context for the original suggestion at this NBuilder feature request and you can also view the Fasterflect feature request.