Description
Hi,
I have two issues, but I'm not sure if ReadableExpressions is supposed to generate working C# code or if the idea is to just generate "human readable" code.
In any case, it would be awesome if there was a way to customize how some things are converted.
The two bugs/issues I ran into are:
Properties
obj.X = 5;
where X is a property, will become obj.set_X(5);
Well, it's not really wrong as internally properties are just methods... but it would be cool if there was a setting to get the "expected" format.
Maybe have a setting like ConvertPropertyAccessToDirectSyntax
or something like that.
Constants
var formatterExp = Constant(formatterInstance);
Call(formatterExp, deserializeMethod, arg1, arg2, arg3));
becomes:
ReferenceFormatter<MyObject>.Deserialize(arg1, arg2, arg3);
Obviously there's nothing else that ReadableExpressions could use other than the type name in this case.
But there should be something like a callback where I can customize how a Expression.Constant
gets written. Having a simple Func<ConstantExpression, string> customizeConstantToString
as a setting would be awesome.