Is there a shortcut in VisualStudio to create a method, like there is "prop, tab" for a property and "ctor, tab" for a constructor?
Ctrl-Shift-F is used to find all the ocuurance of a string with in entire solution and display find result window as shown below. Ctrl-F is used to find a string in the current document, project and all open documents one by one.
To navigate to a class or type, choose it in the middle drop-down. To navigate directly to a procedure or other member of a class, choose it in the right drop-down. To shift focus from the code window to the navigation bar, press the shortcut key combination Ctrl+F2.
There is no Code snippet to create a method other than Main
, but you can do the following.
Type your to be method name, pass the parameters, Once done you will notice a blue under line at the beginning of method name. Click that (or click Ctrl + . ) that will give you the option to create method like:
This will generate a method like:
private static void MySomeMethod(int a, string b)
{
throw new NotImplementedException();
}
There is another clever way for create method (extract).
This way I use if I have method and I would like part of this method move to new private method.
This will create only new private method but automatically set input parameters and output parameter.
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