ProgIdAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<AttributeUsageAttribute(AttributeTargets.Class, Inherited:=False)> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class ProgIdAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Class, Inherited=false)] [ComVisibleAttribute(true)] public sealed class ProgIdAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class, Inherited=false)] [ComVisibleAttribute(true)] public ref class ProgIdAttribute sealed : public Attribute

ProgID は、名前空間と型名を結合することによって、クラスに対して自動的に生成されます。ただし、ProgID は 39 文字に制限され、ピリオド以外の区切り記号を使用できないため、無効な ProgID が生成されることがあります。このような場合は、ProgIdAttribute を使用して、ProgID をクラスに手動で割り当てることができます。

ProgIdAttribute をクラスに適用する方法を次の例に示します。この例では、MyClass のすべての属性を取得し、ProgIdAttribute の Value プロパティを出力します。
<ClassInterface(ClassInterfaceType.AutoDispatch), ProgId("InteropSample.MyClass")> _ Public Class [MyClass] Public Sub New() End Sub 'New End Class '[MyClass] Class TestApplication Public Shared Sub Main() Try Dim attributes As AttributeCollection attributes = TypeDescriptor.GetAttributes(GetType([MyClass])) Dim progIdAttributeObj As ProgIdAttribute = CType(attributes(GetType(ProgIdAttribute)), ProgIdAttribute) Console.WriteLine(("ProgIdAttribute's value is set to : " + progIdAttributeObj.Value)) Catch e As Exception Console.WriteLine(("Exception : " + e.Message.ToString())) End Try End Sub 'Main End Class 'TestApplication End Namespace 'InteropSample
[ClassInterface(ClassInterfaceType.AutoDispatch)] [ProgId("InteropSample.MyClass")] public class MyClass { public MyClass() {} } class TestApplication { public static void Main() { try { AttributeCollection attributes; attributes = TypeDescriptor.GetAttributes(typeof(MyClass)); ProgIdAttribute progIdAttributeObj = (ProgIdAttribute)attributes[typeof(ProgIdAttribute)]; Console.WriteLine("ProgIdAttribute's value is set to : " + progIdAttributeObj.Value); } catch(Exception e) { Console.WriteLine("Exception : " + e.Message); } } }
[ClassInterface(ClassInterfaceType::AutoDispatch)] [ProgId("InteropSample.MyClass")] public ref class MyClass { public: MyClass(){} }; int main() { try { AttributeCollection^ attributes; attributes = TypeDescriptor::GetAttributes( MyClass::typeid ); ProgIdAttribute^ progIdAttributeObj = dynamic_cast<ProgIdAttribute^>(attributes[ ProgIdAttribute::typeid ]); Console::WriteLine( "ProgIdAttribute's value is set to : {0}", progIdAttributeObj->Value ); } catch ( Exception^ e ) { Console::WriteLine( "Exception : {0}", e->Message ); } }
/** @attribute ClassInterface(ClassInterfaceType.AutoDispatch) */ /** @attribute ProgId("InteropSample.MyClass") */ public class MyClass { public MyClass() { } //MyClass } //MyClass class TestApplication { public static void main(String[] args) { try { AttributeCollection attributes; attributes = TypeDescriptor.GetAttributes(MyClass.class.ToType()); ProgIdAttribute progIdAttributeObj = (ProgIdAttribute) (attributes.get_Item(ProgIdAttribute.class.ToType())); Console.WriteLine("ProgIdAttribute's value is set to : " + progIdAttributeObj.get_Value()); } catch (System.Exception e) { Console.WriteLine("Exception : " + e.get_Message()); } } //main } //TestApplication

System.Attribute
System.Runtime.InteropServices.ProgIdAttribute


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProgIdAttribute コンストラクタ
アセンブリ: 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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ProgIdAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
![]() | Value | クラスの ProgID を取得します。 |

ProgIdAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

ProgIdAttribute メンバ
ユーザーがクラスの ProgID を指定することを許可します。
ProgIdAttribute データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |
![]() | Value | クラスの ProgID を取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

- ProgIdAttributeのページへのリンク