Variable Property

Gets or sets the specified variable.

Syntax

Property Variable(varName) As VSVariable

Parameters

varName

Type: String

The name of the variable

Examples

IronPython

#Get a variable
var = Host.ScriptData.Variable[varName]
    

#Set a variable

var = VSVariable(varName, VSVariableDataType.String, varName + " (set by IronPython script)", varName + " (set by IronPython script)", False, VSVariableDefinitionType.VSDynamic)
Host.ScriptData.Variable[varName] = var


C#

//Get a variable

VSVariable var = (VSVariable) ScriptData.get_Variable(varName);


//Set a variable

VSVariable var = new VSVariable(varName, VSVariableDataType.String, varName + " (set by C# script)", varName + " (set by C# script)", false, VSVariableDefinitionType.VSDynamic);

ScriptData.set_Variable(varName, var);

Remarks