Sdílet prostřednictvím


CodeClass2.IsGeneric – vlastnost

Získá hodnotu určující, zda je aktuální třídy nebo struct obecný.

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

Syntaxe

'Deklarace
ReadOnly Property IsGeneric As Boolean
    Get
bool IsGeneric { get; }
property bool IsGeneric {
    bool get ();
}
abstract IsGeneric : bool
function get IsGeneric () : boolean

Hodnota vlastnosti

Typ: System.Boolean
Logická hodnota, která je true -li aktuální třídy nebo struct obecný, false -li jinak.

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

        // Test if element is a generic.
        if (cls.IsGeneric)
            MessageBox.Show("Element is a generic");         
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}

Zabezpečení rozhraní .NET Framework

Viz také

Odkaz

CodeClass2 Rozhraní

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