ComRegisterFunctionAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)
構文
<ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Method, Inherited:=False)> _ Public NotInheritable Class ComRegisterFunctionAttribute Inherits Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)] public sealed class ComRegisterFunctionAttribute : Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets::Method, Inherited=false)] public ref class ComRegisterFunctionAttribute sealed : public Attribute
ComRegisterFunctionAttribute を使用すると、COM クライアントの要件に対応するための任意の登録コードを追加できます。たとえば、Microsoft.Win32 名前空間の登録関数を使用してレジストリを更新できます。登録メソッドを提供する場合は、その登録メソッドで実行された操作を元に戻すための登録解除メソッドにも System.Runtime.InteropServices.ComUnregisterFunctionAttribute を適用する必要があります。
格納しているアセンブリが アセンブリ登録ツール (Regasm.exe) や RegistrationServices.RegisterAssembly API メソッドを使用して (直接的または間接的に) 登録される場合、共通言語ランタイムはこの属性を持つメソッドを呼び出します。この属性を持つメソッドの参照可能範囲 (パブリック、プライベートなど) は任意ですが、このメソッドは static である必要があり、登録する型を表す Type パラメータを 1 つ受け取る必要があります。
適切なシグネチャを持つメソッドに ComRegisterFunctionAttribute と ComUnregisterFunctionAttribute を適用する方法を次の例に示します。
Imports System Imports System.Runtime.InteropServices Public Class MyClassThatNeedsToRegister <ComRegisterFunctionAttribute()> Public Shared Sub _ RegisterFunction(t As Type) 'Insert code here. End Sub <ComUnregisterFunctionAttribute()> Public Shared Sub _ UnregisterFunction(t As Type) 'Insert code here. End Sub End Class
using System; using System.Runtime.InteropServices; public class MyClassThatNeedsToRegister { [ComRegisterFunctionAttribute] public static void RegisterFunction(Type t) { //Insert code here. } [ComUnregisterFunctionAttribute] public static void UnregisterFunction(Type t) { //Insert code here. } }
using namespace System; using namespace System::Runtime::InteropServices; public ref class MyClassThatNeedsToRegister { public: [ComRegisterFunctionAttribute] static void RegisterFunction( Type^ t ) { //Insert code here. } [ComUnregisterFunctionAttribute] static void UnregisterFunction( Type^ t ) { //Insert code here. } };
import System.*; import System.Runtime.InteropServices.*; public class MyClassThatNeedsToRegister { /** @attribute ComRegisterFunctionAttribute() */ public static void RegisterFunction(Type t) { //Insert code here. } //RegisterFunction /** @attribute ComUnregisterFunctionAttribute() */ public static void UnregisterFunction(Type t) { //Insert code here. } //UnregisterFunction } //MyClassThatNeedsToRegister
import System; import System.Runtime.InteropServices; public class MyClassThatNeedsToRegister { ComRegisterFunctionAttribute public static function RegisterFunction(t : Type) : void { //Insert code here. } ComUnregisterFunctionAttribute public static function UnregisterFunction(t : Type) : void { //Insert code here. } }
System.Attribute
System.Runtime.InteropServices.ComRegisterFunctionAttribute
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
ComRegisterFunctionAttribute コンストラクタ
アセンブリ: mscorlib (mscorlib.dll 内)
構文
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
ComRegisterFunctionAttribute プロパティ
ComRegisterFunctionAttribute メソッド
パブリック メソッド
名前 | 説明 | |
---|---|---|
Equals | オーバーロードされます。 ( Attribute から継承されます。) | |
GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) | |
GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) | |
GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) | |
IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) | |
IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) | |
Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |
ComRegisterFunctionAttribute メンバ
アセンブリを COM から使用できるように登録するときに呼び出すメソッドを指定します。これにより、登録処理中にユーザー記述のコードを実行できるようになります。
ComRegisterFunctionAttribute データ型で公開されるメンバを以下の表に示します。
パブリック コンストラクタ
パブリック プロパティ
パブリック メソッド
名前 | 説明 | |
---|---|---|
Equals | オーバーロードされます。 ( Attribute から継承されます。) | |
GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) | |
GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) | |
GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) | |
GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) | |
IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) | |
IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) | |
Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) | |
ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) | |
ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |
- ComRegisterFunctionAttributeのページへのリンク