zspitz / ExpressionTreeToString

String representations of expression trees + library of expression tree objects
MIT License
151 stars 12 forks source link

Add support for the use of enum arguments in ToString #92

Open Ephron-WL opened 1 year ago

Ephron-WL commented 1 year ago

Add support for using enums in ToString in addition to strings. Developers can't remember the available string option values, but could use Intellisense to view and select their desired value.

zspitz commented 1 year ago

There is an enum at ExpressionTreeToString.BuiltInRenderer.

image

I don't know why Intellisense isn't displaying all the members, though:

image

Ephron-WL commented 1 year ago

Ah, ok. Yeah, Intellisense won't recognize that parameter definition.

Your approach is definitely creative, but beyond the capability of IDEs to handle. The IDE is scanning the parameter types and when it sees OneOf<,>, it has no clue what a OneOf does or how it should interpret the type parameters defined for it.

You might consider two overloads,:

That should solve the issue. It is a nice tool. I searched for a long time before I found it!