ComSourceInterfacesAttribute Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Caution
ComSourceInterfacesAttribute may be unavailable in future releases.
Identifies a list of interfaces that are exposed as COM event sources for the attributed class.
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
- Inheritance
- Attributes
Examples
The following example shows how to apply the ComSourceInterfacesAttribute to connect the event sink interface to a class by passing the namespace and event sink interface.
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
Remarks
You can apply this attribute to classes.
You apply this attribute to a managed class to identify the event interfaces that the class exposes as COM connection points. An event interface contains methods that map to the event members of the class. The class event name and the interface method name must be the same. This attribute can accommodate up to four source interfaces for a class by passing the type of the source interface to the appropriate constructor, which take between one and four type arguments. For classes that want to expose more than four source interfaces, the string version of the constructor can be used. For additional information about exposing.NET events to COM clients, see How to: Raise Events Handled by a COM Sink.
Constructors
ComSourceInterfacesAttribute(String) |
Initializes a new instance of the ComSourceInterfacesAttribute class with the name of the event source interface. |
ComSourceInterfacesAttribute(Type, Type, Type, Type) |
Initializes a new instance of the ComSourceInterfacesAttribute class with the types to use as source interfaces. |
ComSourceInterfacesAttribute(Type, Type, Type) |
Initializes a new instance of the |
ComSourceInterfacesAttribute(Type, Type) |
Initializes a new instance of the ComSourceInterfacesAttribute class with the types to use as source interfaces. |
ComSourceInterfacesAttribute(Type) |
Initializes a new instance of the ComSourceInterfacesAttribute class with the type to use as a source interface. |
Properties
TypeId |
When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute) |
Value |
Gets the fully qualified name of the event source interface. |
Methods
Equals(Object) |
Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute) |
GetHashCode() |
Returns the hash code for this instance. (Inherited from Attribute) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
IsDefaultAttribute() |
When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute) |
Match(Object) |
When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
Explicit Interface Implementations
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Maps a set of names to a corresponding set of dispatch identifiers. (Inherited from Attribute) |
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Retrieves the type information for an object, which can be used to get the type information for an interface. (Inherited from Attribute) |
_Attribute.GetTypeInfoCount(UInt32) |
Retrieves the number of type information interfaces that an object provides (either 0 or 1). (Inherited from Attribute) |
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Provides access to properties and methods exposed by an object. (Inherited from Attribute) |