I wanted to declare a new enum/class , but with the exact same <summary> from existing class (for programming purpose) , in small scale i can just type the summary manually , but in large scale it takes just too much time copying and pasting , especially with really long <summary> . How do i do it ?
For example :
/// <summary>
/// Animal
/// </summary>
public enum AnimalListOne {
cat,wolves,fox
}
/// <summary>
/// ..... how do i copy the summary of AnimalListOne ?
/// </summary>
public enum AnimalListTwo {
horse , horseagain , andhorseagain , horsearethebest
}
I just tried it out, so I know it works.
The <inheritdoc src="YourClass"/> works just perfect for your needs.
Unfortunately there isn't a built-in way that I can see in VS2019, or even an easy set of keystrokes, but if you add the Visual Commander Extension, you can add a Command to help you. Unfortunately Visual Commander is somewhat buggy, and won't record the macro for you, but you can add it:
using EnvDTE;
using EnvDTE80;
public class M : VisualCommanderExt.ICommand
{
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.ExpandSelection");
DTE.ExecuteCommand("Edit.SwapAnchor");
DTE.ExecuteCommand("Edit.LineStartExtend");
DTE.ExecuteCommand("Edit.LineStartExtend");
DTE.ExecuteCommand("Edit.Copy");
DTE.ExecuteCommand("Edit.NextMethod");
DTE.ExecuteCommand("Edit.NextMethod");
DTE.ExecuteCommand("Edit.LineStart");
}
}
Put the cursor anywhere in a method comment block, and run the macro. It will copy the comment block to the clipboard and move the cursor to the beginning of the following method. Then you can either paste, or click to put the cursor at the beginning of another method and paste.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With