ComAliasNameAttribute Class
Indicates the COM alias for a parameter or field type.
For a list of all members of this type, see ComAliasNameAttribute Members.
System.Object
System.Attribute
System.Runtime.InteropServices.ComAliasNameAttribute
[Visual Basic] <AttributeUsage(AttributeTargets.Property Or AttributeTargets.Field _ Or AttributeTargets.Parameter Or AttributeTargets.ReturnValue)> NotInheritable Public Class ComAliasNameAttribute Inherits Attribute [C#] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue)] public sealed class ComAliasNameAttribute : Attribute [C++] [AttributeUsage(AttributeTargets::Property | AttributeTargets::Field | AttributeTargets::Parameter | AttributeTargets::ReturnValue)] public __gc __sealed class ComAliasNameAttribute : public Attribute [JScript] public AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue) class ComAliasNameAttribute extends Attribute
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
You can apply this attribute to parameters, fields, properties, or return values.
Example
[Visual Basic, C#, C++] In the following type library, OLE_COLOR is an alias for int. During import the arguments of the Color accessor are marked with the ComAliasNameAttribute to indicate that type library refers to them as OLE_COLOR.
typedef int OLE_COLOR;
interface Baz {
HRESULT SetColor([in] OLE_COLOR cl);
HRESULT GetColor([out, retval] OLE_COLOR *cl);
}
[Visual Basic, C#, C++] imported as:
[Visual Basic] Interface Baz Sub SetColor( <ComAliasName("stdole.OLE_COLOR")> cl As Integer) Function GetColor() As <ComAliasName("stdole.OLE_COLOR")> Integer End Interface [C#] interface Baz { void SetColor([ComAliasName("stdole.OLE_COLOR")] int cl); [return: ComAliasName("stdole.OLE_COLOR")] int GetColor(); } [C++] __gc __interface Baz { void SetColor([ComAliasName(S"stdole.OLE_COLOR")] int cl); [returnvalue: ComAliasName(S"stdole.OLE_COLOR")] int GetColor(); };
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Runtime.InteropServices
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: Mscorlib (in Mscorlib.dll)
See Also
ComAliasNameAttribute Members | System.Runtime.InteropServices Namespace