Represents the data of the global variable.
Syntax
| C# | |
|---|
public interface IGlobalVariable |
Remarks
Example
The following code using
IGlobalVariable Interface for getting information about global variable.
| C# | Copy Code |
|---|
// get a global variable
IGlobalVariable gv = project.GlobalVariables["MyNamespace", "MyGlobalVariable"];
// get comment for current global variable
string comment = gv.Comment;
// if value is empty then set comment for global variable
if (String.IsNullOrWhiteSpace(comment)) gv.Comment = "Set the comment for this global variable";
// get name of global variable
string name = gv.Name;
// get namespace of global variable
string @namespace = gv.Namespace;
// get value of global variable
object value = gv.Value;
// show message about variable
System.Windows.Forms.MessageBox.Show(String.Format("Global variable value is {0}; comment {1}", value, comment),
String.Format("Information about variable {0} from namespace {1}", name, @namespace)); |
| PHP | Copy Code |
|---|
// get a global variable
$gv = $project->GlobalVariables->get_Item("MyNamespace", "MyGlobalVariable");
// get comment for current global variable
$comment = $gv->Comment;
// if value is empty then set comment for global variable
if (String::IsNullOrWhiteSpace($comment)) $gv->Comment = "Set the comment for this global variable";
// get name of global variable
$name = $gv->Name;
// get namespace of global variable
$namespace = $gv->Namespace;
// get value of global variable
$value = $gv->Value;
// show message about variable
System\Windows\Forms\MessageBox::Show(String::Format("Global variable: value is {0}; comment {1}", $value, $comment),
String::Format("Information about variable {0} from namespace {1}", $name, $namespace)); |
Requirements
Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows Seven
See Also