Forums
Forums are Read-Only. Use the new Support Center. To start a general discussion, use the General category when submitting your question.

Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

Last post 4/4/2009 10:29 AM by Mark Miller (DevExpress). 8 replies.
Sort Posts: Previous Next
  • ANDY KUTRUFF_1

    Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    11/24/2008 2:12 PM
    • Not Ranked
    • Joined on 10/22/2008
    • Posts 11

    Whenever I choose to automatically implement an interface, a property that throws NotImplementedException in the getter and setter appears.  For example:

            public int Foo
            {
                get
                {
                    throw new NotImplementedException();
                }
                set
                {
                    throw new NotImplementedException();
                }
            }

     

    It would be great if there was a refactoring that let me turn this into an auto property, or a backing field property.  I know this technically isn't a "refactoring" since it's actually causing the functionality of the code to change, but I find myself running into this quite a bit.

    Thanks,

    Andy

  • Kim Major

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    11/24/2008 4:19 PM
    • Top 500 Contributor
    • Joined on 5/7/2007
    • Posts 42
  • Trevor Westerdahl

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    11/25/2008 3:07 AM
    • Top 25 Contributor
    • Joined on 5/4/2007
    • Portland, Oregon
    • Posts 2,424
    +2
    "ANDY KUTRUFF_1" wrote in message news:242621@community.devexpress.com...

    Whenever I choose to automatically implement an interface, a property that throws NotImplementedException in the getter and setter appears.  For example:

            public int Foo
            {
                get
                {
                    throw new NotImplementedException();
                }
                set
                {
                    throw new NotImplementedException();
                }
            }

     

    It would be great if there was a refactoring that let me turn this into an auto property, or a backing field property.  I know this technically isn't a "refactoring" since it's actually causing the functionality of the code to change, but I find myself running into this quite a bit.

    Thanks,

    Andy



    http://community.devexpress.com//forums/p/71212/242621.aspx#242621

    Trevor Westerdahl - DX Squad
    BLOG: http://trevorunlocked.blogspot.com/
  • Przemyslaw Wlodarczak

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    11/25/2008 6:57 AM
    • Top 150 Contributor
    • Joined on 9/13/2007
    • Poznań, Poland
    • Posts 146

    +3

    Andy, file suggestion to Support Center and post a link here, so everyone can track it.

  • ANDY KUTRUFF_1

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    11/28/2008 12:28 PM
    • Not Ranked
    • Joined on 10/22/2008
    • Posts 11

    Good idea. Done:

    http://www.devexpress.com/Support/Center/p/S130512.aspx

     

  • Trevor Westerdahl

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    11/28/2008 6:52 PM
    • Top 25 Contributor
    • Joined on 5/4/2007
    • Portland, Oregon
    • Posts 2,424
    It would be nice if they implement this request AND make it smart enough to recognize that C# 3.0 is in use and just put the 'get; set;' rather than the entire getter/setter.
     
    btw: I am tracking
    "ANDY KUTRUFF_1" wrote in message news:243203@community.devexpress.com...

    Good idea. Done:

    http://www.devexpress.com/Support/Center/p/S130512.aspx

     



    http://community.devexpress.com//forums/p/71212/243203.aspx#243203

    Trevor Westerdahl - DX Squad
    BLOG: http://trevorunlocked.blogspot.com/
  • Mark Miller (DevExpress)

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    4/2/2009 2:41 PM
    • Top 25 Contributor
    • Joined on 5/2/2007
    • Posts 1,336
    For those who are not tracking, this suggestion has been implemented and is available in the 9.1 release.

    Best regards,
     
    Mark Miller - Developer Express
    C# MVP
    "ANDY KUTRUFF_1" wrote in message news:242621@community.devexpress.com...

    Whenever I choose to automatically implement an interface, a property that throws NotImplementedException in the getter and setter appears.  For example:

            public int Foo
            {
                get
                {
                    throw new NotImplementedException();
                }
                set
                {
                    throw new NotImplementedException();
                }
            }

     

    It would be great if there was a refactoring that let me turn this into an auto property, or a backing field property.  I know this technically isn't a "refactoring" since it's actually causing the functionality of the code to change, but I find myself running into this quite a bit.

    Thanks,

    Andy



    http://community.devexpress.com//forums/p/71212/242621.aspx#242621

  • Trevor Westerdahl

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    4/2/2009 9:56 PM
    • Top 25 Contributor
    • Joined on 5/4/2007
    • Portland, Oregon
    • Posts 2,424
    How is it implemented?
     
    I would "like" three options:
     
    1) Implement the interface itself the way I want it from the get-go
    2) Highlight a single property and convert/implement it
    3) Highlight a property and have an option to 'convert all' (in the same class)
     
     
    "Mark Miller (Developer Express)" wrote in message news:257011@community.devexpress.com...
    For those who are not tracking, this suggestion has been implemented and is available in the 9.1 release.

    Best regards,
     
    Mark Miller - Developer Express
    C# MVP
    "ANDY KUTRUFF_1" wrote in message news:242621@community.devexpress.com...

    Whenever I choose to automatically implement an interface, a property that throws NotImplementedException in the getter and setter appears.  For example:

            public int Foo
            {
                get
                {
                    throw new NotImplementedException();
                }
                set
                {
                    throw new NotImplementedException();
                }
            }

     

    It would be great if there was a refactoring that let me turn this into an auto property, or a backing field property.  I know this technically isn't a "refactoring" since it's actually causing the functionality of the code to change, but I find myself running into this quite a bit.

    Thanks,

    Andy



    http://community.devexpress.com//forums/p/71212/242621.aspx#242621



    http://community.devexpress.com//forums/p/71212/257011.aspx#257011

    Trevor Westerdahl - DX Squad
    BLOG: http://trevorunlocked.blogspot.com/
  • Mark Miller (DevExpress)

    Re: Request new Refactoring: Convert not implemented property to autoproperty or property with backing field

    4/4/2009 10:29 AM
    • Top 25 Contributor
    • Joined on 5/2/2007
    • Posts 1,336
    Hi Trevor,
     
    Currently this code provider is availabe when the caret is on the declaration for the unimplemented property. Press the CodeRush/Refactor key (Ctrl+` by default) and choose one of the Convert to Property options in the Code menu below.

    Best regards,
     
    Mark Miller - Developer Express
    C# MVP

More from DevExpress
Live Chat
Have a pre-sales question?
Need assistance with your evaluation?
We are here to help.
Chat is one of the many ways you can contact members of the DevExpress Team. We are available Monday-Friday between 8:30am and 5:00pm Pacific Time.
If you need additional product information, require pre-sales assistance, or want help with your order, write to us at info@devexpress.com or call us at
+1 (818) 844-3383.