Właściwość CodeClass.ImplementedInterfaces —
Pobiera zbiór interfejsów implementowanych przez CodeClass obiektu.
Przestrzeń nazw: EnvDTE
Zestaw: EnvDTE (w EnvDTE.dll)
Składnia
'Deklaracja
ReadOnly Property ImplementedInterfaces As CodeElements
CodeElements ImplementedInterfaces { get; }
property CodeElements^ ImplementedInterfaces {
CodeElements^ get ();
}
abstract ImplementedInterfaces : CodeElements with get
function get ImplementedInterfaces () : CodeElements
Wartość właściwości
Typ: EnvDTE.CodeElements
A CodeElements kolekcji.
Uwagi
ImplementedInterfacesZwraca CodeElements kolekcji, każdy element typu vsCMElementInterface (zobacz vsCMElement) oraz reprezentujących interfejsu zaimplementowanego przez klasę kodu.
[!UWAGA]
Po dokonaniu niektórych rodzajów modyfikacji, co oznacza, że ich wartości nie może polegać na zawsze pozostawać taki sam może być nie deterministyczny wartości elementów modelu kodu, takich jak klasy, strukturach, funkcje, atrybuty, delegatów i tak dalej.Aby uzyskać więcej informacji, zobacz sekcję wartości elementu modelu kod można zmienić w Odnajdowanie kodu za pomocą modelu kodu (Visual Basic).
Przykłady
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);
}
}
Zabezpieczenia programu .NET Framework
- Pełne zaufanie do bezpośredniego wywołującego. Tego elementu członkowskiego nie można używać w kodzie częściowo zaufanym. Aby uzyskać więcej informacji, zobacz Używanie bibliotek pochodzących z częściowo zaufanego kodu.
Zobacz też
Informacje
Inne zasoby
Porady: kompilowanie i uruchamianie kodu modelu obiektów automatyzacji — przykłady