Freigeben über


ComAliasNameAttribute-Klasse

Gibt den COM-Alias für einen Parameter oder Feldtyp an.

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

Syntax

'Declaration
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Parameter Or AttributeTargets.ReturnValue, Inherited:=False)> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class ComAliasNameAttribute
    Inherits Attribute
'Usage
Dim instance As ComAliasNameAttribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter|AttributeTargets.ReturnValue, Inherited=false)] 
[ComVisibleAttribute(true)] 
public sealed class ComAliasNameAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field|AttributeTargets::Parameter|AttributeTargets::ReturnValue, Inherited=false)] 
[ComVisibleAttribute(true)] 
public ref class ComAliasNameAttribute sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter|AttributeTargets.ReturnValue, Inherited=false) */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class ComAliasNameAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter|AttributeTargets.ReturnValue, Inherited=false) 
ComVisibleAttribute(true) 
public final class ComAliasNameAttribute extends Attribute

Hinweise

Dieses Attribut kann auf Parameter, Felder, Eigenschaften oder Rückgabewerte angewendet werden.

Beispiel

In der folgenden Typbibliothek stellt OLE_COLOR einen Alias für int dar. Beim Importieren werden die Argumente des Color-Accessors mit ComAliasNameAttribute gekennzeichnet, um anzugeben, dass die Typbibliothek auf diese als OLE_COLOR verweist.

typedef int OLE_COLOR;  

interface Baz {
 HRESULT SetColor([in] OLE_COLOR cl);
 HRESULT GetColor([out, retval] OLE_COLOR *cl);
}

wird importiert als:

Interface Baz
    Sub SetColor( <ComAliasName("stdole.OLE_COLOR")> cl As Integer)
    Function GetColor() As <ComAliasName("stdole.OLE_COLOR")> Integer
End Interface
interface Baz {
 void SetColor([ComAliasName("stdole.OLE_COLOR")] int cl);
 [return: ComAliasName("stdole.OLE_COLOR")] int GetColor();
}
interface class Baz
{
   void SetColor( [ComAliasName("stdole.OLE_COLOR")]int cl );

   [returnvalue:ComAliasName("stdole.OLE_COLOR")]
   int GetColor();
};
interface Baz
{
    void SetColor(
        /** @attribute ComAliasName("stdole.OLE_COLOR") 
         */
        int cl);
    /** @attribute.return ComAliasName("stdole.OLE_COLOR") 
     */
    int GetColor();
} //Baz

Vererbungshierarchie

System.Object
   System.Attribute
    System.Runtime.InteropServices.ComAliasNameAttribute

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

ComAliasNameAttribute-Member
System.Runtime.InteropServices-Namespace