Aracılığıyla paylaş


CodeAttribute.Value Özellik

Ayarlar veya nesne için veri değeri alır.

Ad alanı:  EnvDTE
Derleme:  EnvDTE (EnvDTE.dll içinde)

Sözdizimi

'Bildirim
Property Value As String
string Value { get; set; }
property String^ Value {
    String^ get ();
    void set (String^ value);
}
abstract Value : string with get, set
function get Value () : String 
function set Value (value : String)

Özellik Değeri

Tür: String
Nesnenin veri değeri temsil eden bir dize.

Notlar

Bir öznitelik biçiminde ise name(someval, 2), sonra da değer someval, 2.

[!NOT]

Kod modeli öğeler sınıflar, yapılar, İşlevler, öznitelikleri, Temsilciler ve diğerleri gibi değerleri düzenlemeleri değerlerine bağlı her zaman aynı kalacak şekilde dayanıyordu olamaz, diğer bir deyişle, belirli türde yaptıktan sonra non-deterministik olabilir.Daha fazla bilgi için kod modeli öğe değerlerini de değiştirebilirsiniz bölümüne bakın Kod Modeli Kullanarak Kodu Keşfetme (Visual Basic).

Örnekler

Sub ValueExample(ByVal dte As DTE2)

    ' Before running this example, open a code document from a project
    ' and place the insertion point inside a class definition.
    Try
        ' Retrieve the CodeClass at the insertion point.
        Dim sel As TextSelection = _
            CType(dte.ActiveDocument.Selection, TextSelection)
        Dim cls As CodeClass = CType(sel.ActivePoint.CodeElement( _
            vsCMElement.vsCMElementClass), CodeClass)

        ' Enumerate the CodeClass's attributes.
        Dim attrs As String = ""
        Dim attr As CodeAttribute
        For Each attr In cls.Attributes
            attrs &= attr.Name & "(" & attr.Value & ")" & vbCrLf
        Next

        MsgBox(cls.Name & " has the following attributes:" & _
            vbCrLf & vbCrLf & attrs)
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

End Sub
public void ValueExample(DTE2 dte)
{
    // Before running this example, open a code document from a project
    // and place the insertion point inside a class definition.
    try
    {
        // Retrieve the CodeClass at the insertion point.
        TextSelection sel = 
            (TextSelection)dte.ActiveDocument.Selection;
        CodeClass cls = (CodeClass)sel.ActivePoint.get_CodeElement(
            vsCMElement.vsCMElementClass);

        // Enumerate the CodeClass's attributes.
        string attrs = "";
        foreach (CodeAttribute attr in cls.Attributes)
        {
            attrs += attr.Name + "(" + attr.Value + ")" + 
                Environment.NewLine;
        }

        MessageBox.Show(cls.Name + " has the following attributes:" + 
            Environment.NewLine + Environment.NewLine + attrs);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

CodeAttribute Arabirim

EnvDTE Ad Alanı

Diğer Kaynaklar

Nasıl yapılır: Otomasyon Nesne Modeli Kod Örnekleri Derleme ve Çalıştırma