Refactoring to add parameter in constructor

3 posts, 1 answers
  1. Philippe HERTZOG
    Philippe HERTZOG avatar
    3 posts
    Member since:
    Oct 2012

    Posted 14 Apr 2012 Link to this post

    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. Answer
    Svetlozar
    Admin
    Svetlozar avatar
    269 posts

    Posted 19 Apr 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Philippe HERTZOG
    Philippe HERTZOG avatar
    3 posts
    Member since:
    Oct 2012

    Posted 21 Apr 2012 Link to this post

    Thanks for the feedback on go on with the good work on the product.

    Really enjoy it.
Back to Top