ComAliasNameAttribute クラス

パラメータまたはフィールド型の COM エイリアスを示します。

この型のすべてのメンバの一覧については、ComAliasNameAttribute メンバ を参照してください。

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

<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

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

解説

この属性は、パラメータ、フィールド、プロパティ、または戻り値に適用できます。

使用例

[Visual Basic, C#, C++] OLE_COLOR は、次のタイプ ライブラリでは int のエイリアスです。インポート中に、 ComAliasNameAttribute でマークされた Color アクセサの引数は、タイプ ライブラリによって 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++] 次のようにインポートします。

 
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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Runtime.InteropServices

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: Mscorlib (Mscorlib.dll 内)

参照

ComAliasNameAttribute メンバ | System.Runtime.InteropServices 名前空間