Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ExpansionFunction.GetArgument Method

Gets the specified argument.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

public string GetArgument(
	int index
)

Parameters

index
Type: System.Int32

[in] The position in the arguments array to get.

Return Value

Type: System.String
The specified argument if it exists, otherwise null.

This helper method is called from your implementation of the GetCurrentValue method to retrieve the value of the specified argument. If you want to access an argument by name, call the GetFieldValue method with the name of the argument.

An argument can be either an explicit value or a variable. A variable is surrounded by dollar signs ("$myvar$") and represents an expression in the code snippet template that has a value or another expansion function assigned to it. If an argument is not surrounded by dollar signs or is surrounded by single or double quotes, then the argument is taken literally as the value for that argument.

For example, given the function declaration (as seen in a code snippet template file) <function>MyFunction($expr1$,"value1",'value2',value3)</function>, expr1 is a variable that contains a value to be returned, value1, value2, and value3 are all literal values that are returned as is for those arguments.

This method calls the GetFieldValue method to obtain the value of a variable. If the variable cannot be resolved to a value, the name of the variable is surrounded by dollar signs and returned as the value.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft