Marshal.GenerateProgIdForType メソッド
指定した型のプログラム ID (ProgID) を返します。
Public Shared Function GenerateProgIdForType( _
ByVal type As Type _) As String
[C#]
public static string GenerateProgIdForType(Typetype);
[C++]
public: static String* GenerateProgIdForType(Type* type);
[JScript]
public static function GenerateProgIdForType(
type : Type) : String;
パラメータ
- type
ProgID を取得する Type 。
戻り値
指定した型の ProgID。
例外
例外の種類 | 条件 |
---|---|
ArgumentException | type が、COM が作成できるクラスではありません。クラスはパブリックであり、パブリックの既定コンストラクタがあり、COM 参照可能である必要があります。 |
解説
メタデータ内の型に ProgID がある場合は、その ProgID が返されます。それ以外の場合は、型の完全限定名に基づいて ProgID が生成されます。
メモ このメソッドは 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 セキュリティ:
- SecurityPermission (アンマネージ コードを操作するために必要なアクセス許可) SecurityPermissionFlag.UnmanagedCode (関連する列挙体)
参照
Marshal クラス | Marshal メンバ | System.Runtime.InteropServices 名前空間