ComSourceInterfacesAttribute 类

定义

注意

ComSourceInterfacesAttribute may be unavailable in future releases.

标识作为特性化类的 COM 事件源公开的接口的列表。

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
继承
ComSourceInterfacesAttribute
属性

示例

以下示例演示如何通过传递命名空间和事件接收器接口将事件接收器接口应用到 ComSourceInterfacesAttribute 类。

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

注解

可以将此属性应用于类。

将此属性应用于托管类,以标识类公开为 COM 连接点的事件接口。 事件接口包含映射到类的事件成员的方法。 类事件名称和接口方法名称必须相同。 此属性可以通过将源接口的类型传递给适当的构造函数来容纳一个类的最多四个源接口,该构造函数采用 1 到 4 个类型参数。 对于想要公开四个以上的源接口的类,可以使用构造函数的字符串版本。

构造函数

名称 说明
ComSourceInterfacesAttribute(String)
已过时.

使用事件源接口的名称初始化类的新实例 ComSourceInterfacesAttribute

ComSourceInterfacesAttribute(Type, Type, Type, Type)
已过时.

使用要用作源接口的类型初始化类的新实例 ComSourceInterfacesAttribute

ComSourceInterfacesAttribute(Type, Type, Type)
已过时.

使用要用作源接口的类型初始化类的新实例 ComSourceInterfacesAttribute

ComSourceInterfacesAttribute(Type, Type)
已过时.

使用要用作源接口的类型初始化类的新实例 ComSourceInterfacesAttribute

ComSourceInterfacesAttribute(Type)
已过时.

使用要用作源接口的类型初始化类的新实例 ComSourceInterfacesAttribute

属性

名称 说明
TypeId
已过时.

在派生类中实现时,获取此 Attribute的唯一标识符。

(继承自 Attribute)
Value
已过时.

获取事件源接口的完全限定名称。

方法

名称 说明
Equals(Object)
已过时.

返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
GetHashCode()
已过时.

返回此实例的哈希代码。

(继承自 Attribute)
GetType()
已过时.

获取当前实例的 Type

(继承自 Object)
IsDefaultAttribute()
已过时.

在派生类中重写时,指示此实例的值是否为派生类的默认值。

(继承自 Attribute)
Match(Object)
已过时.

在派生类中重写时,返回一个值,该值指示此实例是否等于指定对象。

(继承自 Attribute)
MemberwiseClone()
已过时.

创建当前 Object的浅表副本。

(继承自 Object)
ToString()
已过时.

返回一个表示当前对象的字符串。

(继承自 Object)

显式接口实现

名称 说明
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
已过时.

将一组名称映射到相应的调度标识符集。

(继承自 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
已过时.

检索对象的类型信息,该信息可用于获取接口的类型信息。

(继承自 Attribute)
_Attribute.GetTypeInfoCount(UInt32)
已过时.

检索对象提供的类型信息接口数(0 或 1)。

(继承自 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
已过时.

提供对对象公开的属性和方法的访问。

(继承自 Attribute)

适用于