Sdílet prostřednictvím


CodeClass2.Name – vlastnost

Nastaví nebo získá název třídy.

Obor názvů:  EnvDTE80
Sestavení:  EnvDTE80 (v EnvDTE80.dll)

Syntaxe

'Deklarace
Default Property Name As String
    Get
    Set
string this { get; set; }
property String^ default {
    String^ get ();
    void set (String^ value);
}
abstract Name : string with get, set
function get Name () : String
function set Name (value : String)

Hodnota vlastnosti

Typ: System.String
Řetězec představující název třídy.

Implementuje

CodeClass.Name

Poznámky

Poznámka

Deterministický může být po provedení určité typy úprav, což znamená, že jejich hodnoty nelze dovolávat vždy zůstat stejné hodnoty prvků modelu kód jako třídy, struktury, funkce, atributy, delegátů a tak dále. Další informace naleznete v části Změna hodnoty prvku modelu kódu Discovering Code by Using the Code Model (Visual Basic).

Příklady

[C#]

public void CodeClass2MembersNameExample(DTE2 dte2)
{
    // Before running this example, open a code document from a project
    // and place the insertion point within a class definition.
    try
    {   // Get the CodeClass2 at the insertion point.
        TextSelection sel = 
        TextSelection)dte2.ActiveDocument.Selection;
        CodeClass2 cls = (CodeClass2)sel.ActivePoint.get_CodeElement(
            vsCMElement.vsCMElementClass);
        StringBuilder sb = new StringBuilder(cls.Name + " has the 
        following members:\n");
        foreach (CodeElement ce in cls.Members)
        {
            sb.AppendLine(ce.Name);
        }

        // Display the name and members elements of the CodeClass.
        MessageBox.Show(sb.ToString());
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

CodeClass2 Rozhraní

Name – přetížení

EnvDTE80 – obor názvů

Další zdroje

How to: Compile and Run the Automation Object Model Code Examples

Discovering Code by Using the Code Model (Visual Basic)

Discovering Code by Using the Code Model (Visual C#)