Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refactor method access modifier in visual studio (c#)

I have the following problem. I'm working in visual studio. Let's say, I have an abstract method in base class.

public abstract void DoSomething();

And I override this method in derived classes.

public override void DoSomething();

How can I change the access modifier in base and derived classes automatically? I've tried to use Resharper, but I didn't find anything.

like image 251
TeaLocust Avatar asked Sep 27 '26 08:09

TeaLocust


1 Answers

With ReSharper:

  1. Place caret to "public" keyword in the method signature
  2. Press "Alt+Enter" and select new desired modifier (ie "to protected") Result: modifiers for all methods in the hierarchy are changed
like image 94
Ivan Serduk Avatar answered Sep 29 '26 21:09

Ivan Serduk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!