Sdílet prostřednictvím


CodeClass2.Language – vlastnost

Získá programovací jazyk používaný k vytváření třídy.

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

Syntaxe

'Deklarace
ReadOnly Property Language As String
    Get
string Language { get; }
property String^ Language {
    String^ get ();
}
abstract Language : string
function get Language () : String

Hodnota vlastnosti

Typ: System.String
A CodeModelLanguageConstants konstantu.

Implementuje

CodeClass.Language

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 CodeClass2LanguageExample(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);

        // Determine language used to write the CodeClass.
        if (cls.Language == 
        CodeModelLanguageConstants.vsCMLanguageCSharp)
            MessageBox.Show("CodeClass written in C#");
        else MessageBox.Show("CodeClass was not written in C#");
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

CodeClass2 Rozhraní

Language – 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#)