_Solution.Globals Özellik

Tanım

GlobalsÇözüm (. sln) dosyasına, proje dosyasına veya kullanıcının profil verilerine kaydedilebilecek olan eklenti değerlerini içeren öğesini alır.

public:
 property EnvDTE::Globals ^ Globals { EnvDTE::Globals ^ get(); };
public:
 property EnvDTE::Globals ^ Globals { EnvDTE::Globals ^ get(); };
[System.Runtime.InteropServices.DispId(31)]
public EnvDTE.Globals Globals { [System.Runtime.InteropServices.DispId(31)] get; }
[<System.Runtime.InteropServices.DispId(31)>]
[<get: System.Runtime.InteropServices.DispId(31)>]
member this.Globals : EnvDTE.Globals
Public ReadOnly Property Globals As Globals

Özellik Değeri

Globals

Bir Globals nesnesi.

Öznitelikler

Örnekler

Sub GlobalsExample(ByVal dte As DTE2)  

    ' NOTE: This example requires a reference to the  
    '       System.IO namespace.  

    ' Before running this example, open a solution.  

    Dim soln As Solution = dte.Solution  
    Dim solnName As String = _  
        Path.GetFileNameWithoutExtension(soln.FullName)  

    Dim globals As String  

    MsgBox("Adding global variable TempGlobal = ""TempValue""")  

    soln.Globals.VariableValue("TempGlobal") = "TempValue"  

    Dim names() As Object = CType(soln.Globals.VariableNames, Object())  
    Dim name As String  

    For Each name In names  
        globals &= "    " & name & " = """ & _  
            soln.Globals.VariableValue(name).ToString() & """" & vbCrLf  
    Next  

    MsgBox("Solution " & solnName & _  
        " has the following global variables:" & _  
        vbCrLf & vbCrLf & globals)  

End Sub  
public void GlobalsExample(DTE2 dte)  
{  

    // NOTE: This example requires a reference to the  
    //       System.IO namespace.  

    // Before running this example, open a solution.  

    Solution soln = dte.Solution;  
    string solnName = Path.GetFileNameWithoutExtension(soln.FullName);  

    MessageBox.Show(  
        "Adding global variable TempGlobal = \"TempValue\"");  

    soln.Globals["TempGlobal"] = "TempValue";  

    object[] names = (object[])soln.Globals.VariableNames;  
    string globals = "";  

    foreach (string name in names)  
        globals += "    " + name + " = \"" +   
            soln.Globals[name].ToString() + "\"\n";  

    MessageBox.Show("Solution " + solnName +   
        " has the following global variables:\n\n" + globals);  
}  

Açıklamalar

Bu eklentiler çözüm, proje dosyası ve benzeri bir şekilde yüklendiğinde kullanılabilir.

Solution Globals 'in hiçbir zaman eklentisi oluşturulması gerekmez; Bunlar, makrolar veya diğer Otomasyon istemcileri tarafından da oluşturulabilir.

Not

VariableValue[] ad dizeleri boşluk, iki nokta (:) veya nokta (.) karakterlerini içeremez. Bir ad bu karakterlerden herhangi birine sahipse, "değer beklenen aralıkta değil." hatasını alırsınız.

Şunlara uygulanır