This is a migrated thread and some comments may be shown as answers.

true and false operator overloads and implicit operators

1 Answer 21 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Aleksander
Top achievements
Rank 1
Aleksander asked on 23 Jan 2012, 03:23 PM
Simply put, JustDecompile does not yet recognize the true and false operators used in C#. You can do public static bool operator true(MyType t) {/* implementation */} and same with false. This results in IL: 
.method public hidebysig specialname static
    bool op_True (
        class Test.MyType obj
    ) cil managed
However, when decompiled to C# it shows up as:
public static bool op_True(TotemValue value);
Also, when used the operator shows up like this:
// Original code
if(myObj) /*stuff*/
 
// Decompiled code
if(MyType.op_True(myObj)) /* stuff */
The last point is also valid for implicit operators where they show up as MyType.op_Implicit (haven't tried explicit ones yet).

1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 24 Jan 2012, 06:07 PM
Hi Aleksander,

Many thanks for your bug report. I've logged it and we will provide a fix for it soon. Please stay tuned and continue sending us your feedback. It's much appreciated!

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
Aleksander
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or