I suggest you ...

Local variables associated to boolean expressions when not needed

Given the code:
DateTime start = DateTime.Today;
DateTIme end = DateTime.Today;
if( !start<=end)
{
...
}

is decompiled as:

DateTime start = DateTime.Today;
DateTIme end = DateTime.Today;
bool flag = !(dataStart >= dataEnd);
if (flag)
{
...
}

7 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    mecusorinmecusorin shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Vladimir DragoevAdminVladimir Dragoev (Admin, Telerik JustDecompile) commented  ·   ·  Flag as inappropriate

        Hi,

        Thanks for the feedback. Can you please help us by answering two questions:

        1) Can you share which configuration is used to built the assembly you're decompiling - Debug or Release configuration?

        2) Can you tell us which version of JustDecompile you're using?

      • mecusorinmecusorin commented  ·   ·  Flag as inappropriate

        i can't edit the initial post, a mistake was maded in the example (the decompiler is not changing the boolean expression, just creates an unneeded variable). So i iterate here the correct example:
        Given the code:
        DateTime start = DateTime.Today;
        DateTime end = DateTime.Today;
        if( !start>=end)
        {
        ...
        }

        is decompiled as:

        DateTime start = DateTime.Today;
        DateTIme end = DateTime.Today;
        bool flag = !(start >= end);
        if (flag)
        {
        ...
        }

      Feedback and Knowledge Base