Strange decompiled code

2 posts, 0 answers
  1. Mathias
    Mathias avatar
    10 posts
    Member since:
    Aug 2011

    Posted 24 May 2012 Link to this post

    Hi,

    while looking for solutions for my issues with the timeline control, I've decompiled the HourInterval class. With JD the static constructor looks like this:
    Func<DateTime, string>[] funcArray = new Func<DateTime, string>[2];
    Func<DateTime, string>[] func = funcArray;
    bool flag = false;
    func[flag] = (DateTime date) => date.ToString("hh tt");
    Func<DateTime, string>[] func1 = funcArray;
    bool flag1 = true;
    func1[flag1] = (DateTime date) => date.ToString("ht");
    HourInterval.formatters = funcArray;

    Using another decompile tool it looks like this:
    Func<DateTime, string>[] array = new Func<DateTime, string>[2];
    array[0] = ((DateTime date) => date.ToString("hh tt"));
    array[1] = ((DateTime date) => date.ToString("ht"));
    HourInterval.formatters = array;

    I don't know the original code so can't tell if both are equally "correct", but the second result is much easier to read and understand. Is this difference intentional?

    Regards,
    Mathias
  2. Nikolay G Rusev
    Admin
    Nikolay G Rusev avatar
    44 posts

    Posted 31 May 2012 Link to this post

    Hi Mathias,

     Thank you for the feedback and sorry for the delayed response. While there is definitely room for improvements in code readability, this issue has fairly low priority at this moment.
    That aside, in the example you have given, the usage of boolean variables as array indexers is wrong. We've logged this bug, so it should be fixed in some of our forthcoming releases.

    Kind regards,
    Nikolay G Rusev
    the Telerik team

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

  3. DevCraft banner
Back to Top