Skip to content

Bug: properties and constants #35

Closed
@rikimaru0345

Description

@rikimaru0345

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions