Freigeben über


CodeClass.ImplementedInterfaces-Eigenschaft

Ruft eine Auflistung der von einem CodeClass-Objekt implementierten Schnittstellen ab.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
ReadOnly Property ImplementedInterfaces As CodeElements
    Get
CodeElements ImplementedInterfaces { get; }
property CodeElements^ ImplementedInterfaces {
    CodeElements^ get ();
}
abstract ImplementedInterfaces : CodeElements
function get ImplementedInterfaces () : CodeElements

Eigenschaftswert

Typ: EnvDTE.CodeElements
Eine CodeElements-Auflistung.

Hinweise

ImplementedInterfaces gibt eine CodeElements-Auflistung zurück, wobei jedes Element vom Typ vsCMElementInterface ist (siehe vsCMElement) und eine von der Codeklasse implementierte Schnittstelle darstellt.

Tipp

Die Werte von Codemodellelementen wie Klassen, Strukturen, Funktionen, Attributen, Delegaten usw. können nach bestimmten Bearbeitungsvorgängen nicht deterministisch sein, d. h., dass nicht mehr davon ausgegangen werden kann, dass ihre Werte immer unverändert bleiben. Weitere Informationen finden Sie im Abschnitt zum Änderungsverhalten von Codemodellelementwerten unter Ermitteln von Code über das Codemodell (Visual Basic).

Beispiele

 Sub ImplementedInterfacesExample(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)

        ' Display the class's implemented interfaces.
        Dim ifaces As String
        Dim iface As CodeInterface
        For Each iface In cls.ImplementedInterfaces
            ifaces &= iface.Name & vbCrLf
        Next

        MsgBox(cls.Name & " implements the following interfaces:" & _
            vbCrLf & vbCrLf & ifaces)
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try

End Sub
public void ImplementedInterfacesExample(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);

        // Display the class's implemented interfaces.
        string ifaces = "";
        
        foreach (CodeInterface iface in cls.ImplementedInterfaces)
            ifaces += iface.Name + "\n";

        MessageBox.Show(cls.Name + 
            " implements the following interfaces:\n\n" + ifaces);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework-Sicherheit

Siehe auch

Referenz

CodeClass Schnittstelle

EnvDTE-Namespace

Weitere Ressourcen

Gewusst wie: Kompilieren und Ausführen der Codebeispiele für das Automatisierungsobjektmodell

Ermitteln von Code über das Codemodell (Visual Basic)

Ermitteln von Code über das Codemodell (Visual C#)