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

<ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Enum Or AttributeTargets.Interface Or AttributeTargets.Delegate, Inherited:=False)> _ Public NotInheritable Class GuidAttribute Inherits Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface|AttributeTargets.Delegate, Inherited=false)] public sealed class GuidAttribute : Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Enum|AttributeTargets::Interface|AttributeTargets::Delegate, Inherited=false)] public ref class GuidAttribute sealed : public Attribute
/** @attribute ComVisibleAttribute(true) */ /** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface|AttributeTargets.Delegate, Inherited=false) */ public final class GuidAttribute extends Attribute

この属性は、タイプ ライブラリ インポータ (Tlbimp.exe) がタイプ ライブラリをインポートするときに自動的に適用できますが、アセンブリ、インターフェイス、クラス、列挙体、構造体、またはデリゲートに明示的に適用することもできます。
属性に渡す文字列は、型 Guid の受け入れ可能なコンストラクタ引数の書式にする必要があります。型 Guid との競合を防ぐには、明示的に長い名前 GuidAttribute を使用します。特定の GUID が型に必要な場合にだけ、明示的な GUID を使用します。属性を省略する場合、GUID は自動的に割り当てられます。

固定 GUID で COM にエクスポートされたクラスに GuidAttribute を適用する方法を次の例に示します。
Imports System Imports System.Runtime.InteropServices <GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")> _ Public Class SampleClass ' Insert class members here. End Class
using System; using System.Runtime.InteropServices; [GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")] public class SampleClass { // Insert class members here. }
using namespace System; using namespace System::Runtime::InteropServices; [GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")] public ref class SampleClass { // Insert class members here. };

System.Attribute
System.Runtime.InteropServices.GuidAttribute


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- GuidAttribute クラスのページへのリンク