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

Calling other constructors

3 Answers 24 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Davo
Top achievements
Rank 1
Davo asked on 28 Apr 2011, 03:11 PM
It appears that passing parameters from one constructor to another isn't picked up by JD.

Expected:
protected Option(string prototype, string description) : this(prototype, description, 1)
{
}


JD output:
protected Option(string prototype, string description)
{
}

3 Answers, 1 is accepted

Sort by
0
Tsviatko Yovtchev
Telerik team
answered on 04 May 2011, 09:27 AM
Hello Davo,

 Yep, we seem to have this problem. Thanks for letting us know. We are gonna try fixing that before the official release.

Kind regards,
Tsviatko Yovtchev
the Telerik team

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

0
Adam
Top achievements
Rank 1
answered on 12 Oct 2011, 07:12 PM
I have a similar scenario where "base" appears, but incorrectly:

When you have "readonly", inline-declared items within the class, the "base" is actually there this time, but it is put where it isn't valid C# (right after the inline-declared values are called in the constructor). The inline declarations being moved to the constructor may be congruent with the compiled results of that shorthand (haven't confirmed), but that "base" call definitely got bumped out of place.

Original:
public class Class2 : Class1 {
    private readonly string _snippetsImageSmall = "readonly string";
    private Dictionary<string, string> _snippets = new Dictionary<string, string>();
    public string Something { get; set; }
 
    public Class2()
        : base("othertest", "value") {
 
        // Need something here that won't be optimized away completely.
        this.Something = "x";
    }
}

JustDecompile Output:
public class Class2 : Class1
{
    private readonly string _readonlyString;
 
    private Dictionary<string, string> _someInitializedField;
 
    public string Something
    {
        get;
        set;
    }
 
    public Class2()
    {
        this._readonlyString = "readonly string";
        this._someInitializedField = new Dictionary<string, string>();
        base("othertest", "value");
        this.Something = "x";
    }
}
0
Nikolay G Rusev
Telerik team
answered on 18 Oct 2011, 08:25 AM
Hello Adam,

Thank you for the feedback. We know about this issue and we have it logged so it will definitely be fixed in a future release. Keep the feedback coming. It is much appreciated.

Greetings,
Nikolay G Rusev
the Telerik team

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

Tags
General Discussions
Asked by
Davo
Top achievements
Rank 1
Answers by
Tsviatko Yovtchev
Telerik team
Adam
Top achievements
Rank 1
Nikolay G Rusev
Telerik team
Share this question
or