ComSourceInterfacesAttribute Klasa

Definicja

Przestroga

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ć element w ComSourceInterfacesAttribute celu połączenia interfejsu ujścia zdarzeń z klasą, przekazując interfejs przestrzeni nazw i 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. Aby uzyskać dodatkowe informacje o zdarzeniach exposing.NET klientów COM, zobacz Instrukcje: wywoływanie zdarzeń obsługiwanych przez ujście MODELU COM.

Konstruktory

ComSourceInterfacesAttribute(String)

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

ComSourceInterfacesAttribute(Type)

Inicjuje ComSourceInterfacesAttribute nowe wystąpienie klasy z typem, które ma być używane jako interfejs źródłowy.

ComSourceInterfacesAttribute(Type, Type)

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

ComSourceInterfacesAttribute(Type, Type, Type)

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

ComSourceInterfacesAttribute(Type, Type, Type, Type)

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

Właściwości

TypeId

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

(Odziedziczone po Attribute)
Value

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

Metody

Equals(Object)

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

(Odziedziczone po Attribute)
GetHashCode()

Zwraca wartość skrótu dla tego wystąpienia.

(Odziedziczone po Attribute)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
IsDefaultAttribute()

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

(Odziedziczone po Attribute)
Match(Object)

Po przesłonięciu w klasie pochodnej zwraca wartość wskazującą, czy to wystąpienie jest równe określonemu obiektowi.

(Odziedziczone po Attribute)
MemberwiseClone()

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

(Odziedziczone po Object)
ToString()

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

(Odziedziczone po Object)

Jawne implementacje interfejsu

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

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

(Odziedziczone po Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Pobiera informacje o typie dla obiektu, który może służyć do pobierania informacji o typie dla interfejsu.

(Odziedziczone po Attribute)
_Attribute.GetTypeInfoCount(UInt32)

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)

Umożliwia dostęp do właściwości i metod udostępnianych przez obiekt.

(Odziedziczone po Attribute)

Dotyczy