BlackWaspTM

This web site uses cookies. By using the site you accept the cookie policy.This message is for compliance with the UK ICO law.

Visual Studio
VS 2005+

Visual Studio Parameter Tips

When using methods with large numbers of parameters or with multiple overloaded versions, remembering the sequence of required parameters can be difficult. Using Visual Studio's parameter tips commands, the need for this recall is removed.

Parameter Tips

Visual Studio 2005 and later versions introduce the use of parameter tips. As the complexity of your programs and the .NET framework's classes grow, it is usual to see methods with multiple parameters and overloaded versions. Ensuring that the correct set of parameters, in the right order and with valid data types, is used becomes more difficult under these circumstances.

Parameter tips help by allowing all of the required parameters for a method to be instantly inserted into the source code. These parameter placeholders can then be replaced with the values that you wish to pass to the method.

Signature Tool Tips

After typing the name of a method and adding an opening parenthesis character, "(", a tool tip appears. This tooltip shows the signature of the method that has been identified. If there are overloaded versions of the method, two arrows are displayed and can be clicked to cycle through the variations that are available. The up and down arrow keys on the keyboard may also be used for this purpose.

If the tool tip is allowed to stay on the screen as the method's parameters are added, the current parameter is shown in bold text in the tip. This can be helpful to ensure that the arguments are correctly defined.

Pasting Parameter Tips

Sometimes it is not possible to retain the tool tip whilst constructing a method call. In these situations, the parameter list can be inserted into the code using the "Paste Parameter Tips" command. Whilst the tooltip showing the correct signature is visible, press CTRL-ALT-SHIFT-P.

When the parameter tips are inserted, the type and name of each argument appears. Where output or reference parameters are used by the method, the "out" or "ref" keyword is added automatically. Each parameter can then be individually amended to use the correct value, variable or expression.

Copying Parameter Tips

An alternative to pasting the parameter tips into the code directly is to copy them to the clipboard. This is particularly useful when a method is to be called more than once. The copied text includes the full signature of the method including the return type. To copy the parameter tips press CTRL-ALT-SHIFT-C whilst the correct signature is visible in the tool tip.

27 April 2008