ExpansionFunction.GetArgument Method
Gets the specified argument.
Namespace: Microsoft.VisualStudio.Package
Assemblies: Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
Syntax
'Dichiarazione
Public Function GetArgument ( _
index As Integer _
) As String
'Utilizzo
Dim instance As ExpansionFunction
Dim index As Integer
Dim returnValue As String
returnValue = instance.GetArgument(index)
public string GetArgument(
int index
)
public:
String^ GetArgument(
int index
)
member GetArgument :
index:int -> string
public function GetArgument(
index : int
) : String
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 nulla null reference (Nothing in Visual Basic).
Remarks
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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.