Visual Studio 2010: The easiest way to duplicate a class?

Is there an easy way to duplicate a class with a different name?

+3
source share
6 answers

I'm not sure what this can be called the easiest way, but if you have ReSharper , you can use it Copy type to copy classes / interfaces / structures with control over the namespace into which the copy is copied and the name in the copy, which means that if you copy a class with 5 constructors, the copy will be completely renamed to match the name of the new class.

However, depending on what you are trying to achieve, using the Extract Interface or Extract Superclass may be a better option.

+9
source
  • Open file in Visual Studio.
  • Click Ctrl+A.
  • Click Ctrl+C.
  • Create a new file for the new class.
  • Click Ctrl+Vin the new file.
  • Replace all old class names with a new one. ( Ctrl+H)
+8
source

, , .

, , , , . , , , .

+6

, , , , :-) ! !

+3

?

, . , - /?

, , / .

+1

. ​​ , OO.

+1

Source: https://habr.com/ru/post/1792324/


All Articles