DelegateDecompiler
DelegateDecompiler copied to clipboard
Switch case and if-elseif conditional not supported
Hi Alexander, I am working on a project where we use the Computed attribute on an enum. The enum depends on some condition that is in a switch case. Unfortunatelly the switch case is not supported and the default value is always returned when I apply the Decompile Method. We try to use If - elseif instead of the switch case but it does not work neither.
@okomeiht thanks for reporting the issue. Can you please show some code?
@okomeiht, ok, I understood what you mean. I will try to fix it, when I will have some time.
Ok thanks. Great job on the library.
I am encountering the same problem.
Thanks for looking into this^^
Any fix or workaround for this as of now?
AFAIK the ?:
ternary operator is implemented, maybe you can give it a try.
Eg.
[Computed]
public SomeEnum Prop
get {
return condition1
? SomeEnum.One
: condition2
? SomeEnum.Two
: condition3
...
: SomeEnum.Hundred;
}
}
@gvas Thanks, yes that works. Even normal switch case worked for me when I tried. Didnt try with if-else yet. This library is awesome!