Feature request: safe delete interface implementation

As an opposite to "implement interface" I would like to have a way to quickly remove an interface implementation. Imagine this code:

    1 using System.ComponentModel;
    2 using FinancialApps.Client.WCFService;
    3 
    4 namespace FinancialApps.Client.Views.PublicationManager
    5 {
    6     public class MagazinePE : INotifyPropertyChanged
    7     {
    8         public MagazinePE(MagazineBE magazine) : this(magazine, false)
    9         {
   10         }
   11 
   12         private MagazinePE(MagazineBE magazine, bool isChecked)
   13         {
   14             this.IsChecked = isChecked;
   15             this.Id = magazine.Id;
   16             this.Name = magazine.Name;
   17             this.MagazineTable = magazine.MagazineTable;
   18         }
   19 
   20         protected MagazineTableBE MagazineTable { get; set; }
   21         protected string Name { get; set; }
   22         public bool IsChecked { get; set; }
   23         public int Id { get; set; }
   24 
   25         #region INotifyPropertyChanged Members
   26 
   27         public event PropertyChangedEventHandler PropertyChanged;
   28 
   29         #endregion
   30     }
   31 }


I want to be able to position my caret on the INotifyPropertyChanged interface and hit <Ctrl><R><D> to remove the interface and its implementation so that the resulting code is this:

    1 using FinancialApps.Client.WCFService;
    2 
    3 namespace FinancialApps.Client.Views.PublicationManager
    4 {
    5     public class MagazinePE
    6     {
    7         public MagazinePE(MagazineBE magazine) : this(magazine, false)
    8         {
    9         }
   10 
   11         private MagazinePE(MagazineBE magazine, bool isChecked)
   12         {
   13             this.IsChecked = isChecked;
   14             this.Id = magazine.Id;
   15             this.Name = magazine.Name;
   16             this.MagazineTable = magazine.MagazineTable;
   17         }
   18 
   19         protected MagazineTableBE MagazineTable { get; set; }
   20         protected string Name { get; set; }
   21         public bool IsChecked { get; set; }
   22         public int Id { get; set; }
   23     }
   24 }


2 comments

Hello Gabriel Lozano-Moran,

This requires full scan of all source code where type MagazinePE can be accessible.
For example, you can have function GetMagazine on Store type that returns
MagazinePE. Then, you use it like this:

Subscribe(store.GetMagazine());

Where Subscribe method gets INotifyPropertyChanged as parameter. There is
no sign of the fact that MagazinePE or INotifyPropertyChanged is involved
in that place, so indexed scan cannot be performed. That would take a lot
of time to verify that refactoring doesn't break anything.

What you can do is invoke "Navigate To" command on interface name, select
"Implementing Members" and it will highlight all implementing members of
interface. Then you can remove interface and go through each member and decide
if you want to delete it.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


G> As an opposite to "implement interface" I would like to have a way to
G> quickly remove an interface implementation. Imagine this code:
G>
G> 1 using System.ComponentModel;
G> 2 using FinancialApps.Client.WCFService;
G> 3
G> 4 namespace FinancialApps.Client.Views.PublicationManager
G> 5 {
G> 6     public class MagazinePE : INotifyPropertyChanged
G> 7     {
G> 8         public MagazinePE(MagazineBE magazine) : this(magazine,
G> false)
G> 9         {
G> 10         }
G> 11
G> 12         private MagazinePE(MagazineBE magazine, bool isChecked)
G> 13         {
G> 14             this.IsChecked = isChecked;
G> 15             this.Id = magazine.Id;
G> 16             this.Name = magazine.Name;
G> 17             this.MagazineTable = magazine.MagazineTable;
G> 18         }
G> 19
G> 20         protected MagazineTableBE MagazineTable { get; set; }
G> 21         protected string Name { get; set; }
G> 22         public bool IsChecked { get; set; }
G> 23         public int Id { get; set; }
G> 24
G> 25         #region INotifyPropertyChanged Members
G> 26
G> 27         public event PropertyChangedEventHandler
G> PropertyChanged;
G> 28
G> 29         #endregion
G> 30     }
G> 31 }
G> I want to be able to position my caret on the INotifyPropertyChanged
G> interface and hit  http://www.jetbrains.net/devnet/message/5247621#5247621


0

Okay thank you. I hope you guys don't mind that I report everything I encounter. I mean, you can do with my feedback as you please. ReSharper is one of the best products out there without doubt :-)

0

Please sign in to leave a comment.