Globals.VariableNames 속성
현재 모든 전역 변수 이름의 목록을 가져옵니다.
네임스페이스: EnvDTE
어셈블리: EnvDTE(EnvDTE.dll)
구문
‘선언
ReadOnly Property VariableNames As Object
Get
Object VariableNames { get; }
property Object^ VariableNames {
Object^ get ();
}
abstract VariableNames : Object
function get VariableNames () : Object
속성 값
형식: System.Object
현재 모든 전역 변수 이름을 나타내는 개체입니다.
예제
Sub OnAddinLoaded(ByVal dte As DTE)
' Count the number of times an add-in is loaded
' and store the value in the solution.
Dim globals As Globals
globals = dte.Solution.Globals
If globals.VariableExists("AddinLoadCounter") Then
' The counter has already been set, so increment it.
Dim int32 As System.Int32
int32 = System.Int32.Parse(CStr(globals("AddinLoadCounter")))
int32 += 1
globals("AddinLoadCounter") = int32.ToString()
Else
' Counter has never been set, so create and initialize it.
globals("AddinLoadCounter") = 1.ToString()
globals.VariablePersists("AddinLoadCounter") = True
End If
MsgBox("This add-in has been loaded: " & _
globals.VariableValue("AddinLoadCounter") & " times.")
End Sub
void OnAddinLoaded(_DTE applicationObject)
{
// Count the number of times an add-in is loaded
// and store the value in the solution.
Globals globals;
globals = applicationObject.Solution.Globals;
if(globals.get_VariableExists("AddinLoadCounter"))
{
// The counter has already been set, so increment it.
System.Int32 int32;
int32 = System.Int32.Parse((string)
globals["AddinLoadCounter"]);
int32++;
globals["AddinLoadCounter"] = int32.ToString();
}
else
{
// Counter has never been set, so create and initialize it.
globals["AddinLoadCounter"] = 1.ToString();
globals.set_VariablePersists("AddinLoadCounter", true);
}
System.Windows.Forms.MessageBox.Show("This add-in has been loaded:
" + globals.VariableValue["AddinLoadCounter"] + " times.");
}
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.