Udostępnij za pośrednictwem


ComSourceInterfacesAttribute Klasa

Definicja

Uwaga

ComSourceInterfacesAttribute may be unavailable in future releases.

Identyfikuje listę interfejsów, które są uwidocznione jako źródła zdarzeń COM dla klasy przypisanej.

public ref class ComSourceInterfacesAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
[System.Obsolete("ComSourceInterfacesAttribute may be unavailable in future releases.")]
public sealed class ComSourceInterfacesAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
public sealed class ComSourceInterfacesAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=false)]
public sealed class ComSourceInterfacesAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ComSourceInterfacesAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
[<System.Obsolete("ComSourceInterfacesAttribute may be unavailable in future releases.")>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=false)>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, Inherited=true)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ComSourceInterfacesAttribute = class
    inherit Attribute
Public NotInheritable Class ComSourceInterfacesAttribute
Inherits Attribute
Dziedziczenie
ComSourceInterfacesAttribute
Atrybuty

Przykłady

W poniższym przykładzie pokazano, jak zastosować ComSourceInterfacesAttribute interfejs w celu połączenia interfejsu ujścia zdarzeń z klasą, przekazując przestrzeń nazw i interfejs ujścia zdarzeń.

using namespace System::Runtime::InteropServices;

[ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")]
public ref class Baz{};
using System.Runtime.InteropServices;

[ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")]
public class Baz
{
   //Insert code here.
}
Imports System.Runtime.InteropServices

<ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")> _
public Class Baz
    'Insert code here.
End Class

Uwagi

Ten atrybut można zastosować do klas.

Ten atrybut jest stosowany do klasy zarządzanej, aby zidentyfikować interfejsy zdarzeń, które klasa uwidacznia jako punkty połączenia COM. Interfejs zdarzenia zawiera metody mapujące na składowe zdarzeń klasy. Nazwa zdarzenia klasy i nazwa metody interfejsu muszą być takie same. Ten atrybut może pomieścić do czterech interfejsów źródłowych dla klasy, przekazując typ interfejsu źródłowego do odpowiedniego konstruktora, który przyjmuje od jednego do czterech argumentów typu. W przypadku klas, które chcą uwidocznić więcej niż cztery interfejsy źródłowe, można użyć wersji ciągu konstruktora.

Konstruktory

Nazwa Opis
ComSourceInterfacesAttribute(String)
Przestarzałe.

Inicjuje nowe wystąpienie ComSourceInterfacesAttribute klasy o nazwie interfejsu źródła zdarzeń.

ComSourceInterfacesAttribute(Type, Type, Type, Type)
Przestarzałe.

Inicjuje ComSourceInterfacesAttribute nowe wystąpienie klasy z typami, które mają być używane jako interfejsy źródłowe.

ComSourceInterfacesAttribute(Type, Type, Type)
Przestarzałe.

Inicjuje ComSourceInterfacesAttribute nowe wystąpienie klasy z typami, które mają być używane jako interfejsy źródłowe.

ComSourceInterfacesAttribute(Type, Type)
Przestarzałe.

Inicjuje ComSourceInterfacesAttribute nowe wystąpienie klasy z typami, które mają być używane jako interfejsy źródłowe.

ComSourceInterfacesAttribute(Type)
Przestarzałe.

Inicjuje nowe wystąpienie ComSourceInterfacesAttribute klasy z typem używanym jako interfejs źródłowy.

Właściwości

Nazwa Opis
TypeId
Przestarzałe.

Po zaimplementowaniu w klasie pochodnej pobiera unikatowy identyfikator dla tego Attribute.

(Odziedziczone po Attribute)
Value
Przestarzałe.

Pobiera w pełni kwalifikowaną nazwę interfejsu źródła zdarzeń.

Metody

Nazwa Opis
Equals(Object)
Przestarzałe.

Zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
GetHashCode()
Przestarzałe.

Zwraca kod skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()
Przestarzałe.

Pobiera Type bieżącego wystąpienia.

(Odziedziczone po Object)
IsDefaultAttribute()
Przestarzałe.

Po zastąpieniu w klasie pochodnej wskazuje, czy wartość tego wystąpienia jest wartością domyślną dla klasy pochodnej.

(Odziedziczone po Attribute)
Match(Object)
Przestarzałe.

Po zastąpieniu w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()
Przestarzałe.

Tworzy płytkią kopię bieżącego Object.

(Odziedziczone po Object)
ToString()
Przestarzałe.

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

Nazwa Opis
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
Przestarzałe.

Zestaw nazw jest mapowany na odpowiedni zestaw identyfikatorów wysyłania.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
Przestarzałe.

Pobiera informacje o typie obiektu, którego można użyć do uzyskania informacji o typie dla interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)
Przestarzałe.

Pobiera informację o liczbie typów interfejsów, jakie zawiera obiekt (0 lub 1).

(Odziedziczone po Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
Przestarzałe.

Zapewnia dostęp do właściwości i metod uwidocznionych przez obiekt.

(Odziedziczone po Attribute)

Dotyczy