Freigeben über


CoClassAttribute-Klasse

 

Veröffentlicht: Oktober 2016

Gibt den Klassenbezeichner einer aus einer Typbibliothek importierten Co-Klasse an.

Namespace:   System.Runtime.InteropServices
Assembly:  mscorlib (in mscorlib.dll)

Vererbungshierarchie

System.Object
  System.Attribute
    System.Runtime.InteropServices.CoClassAttribute

Syntax

[AttributeUsageAttribute(AttributeTargets.Interface, Inherited = false)]
[ComVisibleAttribute(true)]
public sealed class CoClassAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Interface, Inherited = false)]
[ComVisibleAttribute(true)]
public ref class CoClassAttribute sealed : Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Interface, Inherited = false)>]
[<ComVisibleAttribute(true)>]
type CoClassAttribute = 
    class
        inherit Attribute
    end
<AttributeUsageAttribute(AttributeTargets.Interface, Inherited := False)>
<ComVisibleAttribute(True)>
Public NotInheritable Class CoClassAttribute
    Inherits Attribute

Konstruktoren

Name Beschreibung
System_CAPS_pubmethod CoClassAttribute(Type)

Initialisiert neue Instanz der der CoClassAttribute mit dem Klassenbezeichner der ursprünglichen Co-Klasse.

Eigenschaften

Name Beschreibung
System_CAPS_pubproperty CoClass

Ruft den Klassenbezeichner der ursprünglichen Co-Klasse.

System_CAPS_pubproperty TypeId

Ruft bei Implementierung in einer abgeleiteten Klasse einen eindeutigen Bezeichner für dieses Attribute ab.(Geerbt von „Attribute“.)

Methoden

Name Beschreibung
System_CAPS_pubmethod Equals(Object)

Diese API unterstützt die Produkt Infrastruktur und sollte nicht direkt aus dem Code verwendet werden. Gibt einen Wert zurück, der angibt, ob diese Instanz gleich einem angegebenen Objekt ist.(Geerbt von „Attribute“.)

System_CAPS_pubmethod GetHashCode()

Gibt den Hashcode für diese Instanz zurück.(Geerbt von „Attribute“.)

System_CAPS_pubmethod GetType()

Ruft den Type der aktuellen Instanz ab.(Geerbt von „Object“.)

System_CAPS_pubmethod IsDefaultAttribute()

Gibt beim Überschreiben in einer abgeleiteten Klasse an, ob der Wert der Instanz der Standardwert für die abgeleitete Klasse ist.(Geerbt von „Attribute“.)

System_CAPS_pubmethod Match(Object)

Ruft beim Überschreiben in einer abgeleiteten Klasse gibt einen Wert, der angibt, ob diese Instanz gleich ein angegebenen Objekt ist.(Geerbt von „Attribute“.)

System_CAPS_pubmethod ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.(Geerbt von „Object“.)

Explizite Schnittstellenimplementierungen

Name Beschreibung
System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Ordnet eine Reihe von Namen einer entsprechenden Reihe von Dispatchbezeichnern zu.(Geerbt von „Attribute“.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Ruft die Typinformationen für ein Objekt ab, mit deren Hilfe die Typinformationen für eine Schnittstelle abgerufen werden können.(Geerbt von „Attribute“.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.GetTypeInfoCount(UInt32)

Ruft die Anzahl der Schnittstellen mit Typinformationen ab, die von einem Objekt bereitgestellt werden (0 oder 1).(Geerbt von „Attribute“.)

System_CAPS_pubinterfaceSystem_CAPS_privmethod _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Stellt den Zugriff auf von einem Objekt verfügbar gemachte Eigenschaften und Methoden bereit.(Geerbt von „Attribute“.)

Hinweise

You can apply this attribute to coclass interfaces, although the [<topic://cpgrfTypeLibraryImporterTlbimpexe>] typically applies it for you when it imports a type library.

When Tlbimp.exe imports a coclass, it produces a managed class and an interface to represent the coclass. The coclass interface has the same interface identifier (IID) as the default interface of the original coclass. The imported coclass interface also retains the name of the coclass. Tlbimp.exe appends the original coclass name with "class" to identify the imported class.

You rarely apply this attribute. However, if plan to write source code that produces metadata that closely simulates metadata produced by Tlbimp.exe, you should create a coclass interface for each coclass. Use the name of the original coclass to name the coclass interface and derive it from the default interface. In addition to the T:System.Runtime.InteropServices.CoClassAttribute, you must also apply the T:System.Runtime.InteropServices.ComImportAttribute and T:System.Runtime.InteropServices.GuidAttribute to the coclass interface. For additional information about how Tlbimp.exe imports interfaces and coclasses from a type library, see Imported Type Conversion.

Versionsinformationen

Universelle Windows-Plattform
Verfügbar seit 8
.NET Framework
Verfügbar seit 1.1
Portierbare Klassenbibliothek
Unterstützt in: portierbare .NET-Plattformen
Silverlight
Verfügbar seit 2.0
Windows Phone Silverlight
Verfügbar seit 7.0
Windows Phone
Verfügbar seit 8.1

Threadsicherheit

Alle öffentlichen statischen Member ( Shared in Visual Basic) dieses Typs sind threadsicher. Die Threadsicherheit für Instanzmember ist nicht garantiert.

Siehe auch

ComImportAttribute
GuidAttribute
System.Runtime.InteropServices-Namespace
Tlbimp.exe (Type Library Importer)

Zurück zum Anfang