次の方法で共有


Marshal.GetMethodInfoForComSlot メソッド

指定した仮想関数テーブル (VTBL) スロットの MethodInfo を取得します。

Public Shared Function GetMethodInfoForComSlot( _
   ByVal t As Type, _   ByVal slot As Integer, _   ByRef memberType As ComMemberType _) As MemberInfo
[C#]
public static MemberInfo GetMethodInfoForComSlot(Typet,intslot,   ref ComMemberTypememberType);
[C++]
public: static MemberInfo* GetMethodInfoForComSlot(Type* t,intslot,ComMemberType* memberType);
[JScript]
public static function GetMethodInfoForComSlot(
   t : Type,slot : int,memberType : ComMemberType) : MemberInfo;

パラメータ

  • t
    MethodInfo の取得対象となる型。
  • slot
    VTBL スロット。
  • memberType
    正常に返された場合は、メンバの型。これは、 ComMemberType 列挙体メンバの 1 つです。

戻り値

指定した VTBL (V テーブル) スロットにあるメンバを表す MemberInfo

例外

例外の種類 条件
ArgumentException t は COM から参照できません。

解説

このメソッドが返すスロット番号は 0 から始まり、3 つの IUnknown メソッドのほか、4 つの IDispatch メソッドが含まれることがあるため、利用可能な最初のスロットの値は 3 または 7 となります。 GetMethodInfoForComSlotMarshal.GetComSlotForMethodInfo とは反対の機能を提供します。 Marshal.GetEndComSlot および Marshal.GetStartComSlotGetMethodInfoForComSlot と組み合わせて使用すると、指定した範囲内でスロットを渡すことができます。

memberType パラメータは、メソッドの戻り時にのみ使用します。このパラメータは、返された MemberInfo に対応する COM メンバ、たとえば一般的なメソッドやプロパティ アクセサ (get、set など) の型を格納します。

メモ   このメソッドは SecurityAction.LinkDemand を使用して、信頼関係のないコードからの呼び出しを防ぎます。 SecurityPermissionAttribute.UnmanagedCode アクセス許可は、直前の呼び出し元にのみ要求されます。信頼性が一部しか確認されていないコードから呼び出すことができるコードの場合、ユーザー入力を検証せずに Marshal クラスに渡すことは避けてください。 LinkDemand メンバの使用に関する重要な制約事項については、「 Demand と LinkDemand 」を参照してください。

必要条件

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

.NET Framework セキュリティ:

参照

Marshal クラス | Marshal メンバ | System.Runtime.InteropServices 名前空間 | GetComSlotForMethodInfo | GetEndComSlot | GetStartComSlot | ComMemberType