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

Refactoring to add parameter in constructor

2 Answers 77 Views
Refactorings
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Philippe HERTZOG
Top achievements
Rank 1
Philippe HERTZOG asked on 14 Apr 2012, 09:44 PM
Hello,



I can't find a way to refactor my code in order to add a parameter in the constructor of my class.



Let's suppose following code :

public class Author

{

public string FirstName { get; private set; }

public string LastName { get;private set; }

public Author()

{

this.FirstName = firstName;

}

}

When a select firstName, I have option to introduce variable, field or property but not a variable for the constructor.

What I would like is to refactor to introduce the misssing parameter to get a constructor signature like following :

public Author(string firstName)

{

this.FirstName = firstName;

}



Is there a way to do it or is this refactoring not available?

 

 


I can't find

2 Answers, 1 is accepted

Sort by
0
Accepted
Svetlozar
Telerik team
answered on 19 Apr 2012, 02:00 PM
Hi,

Thank you for your feedback! We have Create Parameter quick fix for cases like these, but it is available only for methods. We will improve it to work for constructors, too.

Regards,
Svetlozar
the Telerik team

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

0
Philippe HERTZOG
Top achievements
Rank 1
answered on 21 Apr 2012, 10:12 AM
Thanks for the feedback on go on with the good work on the product.

Really enjoy it.
Tags
Refactorings
Asked by
Philippe HERTZOG
Top achievements
Rank 1
Answers by
Svetlozar
Telerik team
Philippe HERTZOG
Top achievements
Rank 1
Share this question
or