简体   繁体   中英

How to automatically change the signature of overridden methods when the signature of the virtual method change with MSV2008 in C#?

I have a virtual method which is overridden many times. I would like to add a parameter to all these methods.

Can we just add a parameter to the virtual method and use a refactor for automatically updating all overridden methods ?

I know it is possible to Remove or Reorder parameters with the refactor, but I don't find Add.

That functionality is not included in Visual Studio.

As was mentioned in a comment, I believe you can get that by installing a plugin such as Resharper (see the documentation on changing method signatures ).

If you don't want install a plugin (like me), I use Visual Studio's feature to Find All References (by right-clicking on the function, or using the hotkey Ctrl + K, R). That at least makes it easier to do: simply double-click on each search result and make the change.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM