Share via


CodeTypeDeclaration.TypeAttributes プロパティ

定義

型の属性を取得または設定します。

public:
 property System::Reflection::TypeAttributes TypeAttributes { System::Reflection::TypeAttributes get(); void set(System::Reflection::TypeAttributes value); };
public System.Reflection.TypeAttributes TypeAttributes { get; set; }
member this.TypeAttributes : System.Reflection.TypeAttributes with get, set
Public Property TypeAttributes As TypeAttributes

プロパティ値

型の属性を示す TypeAttributes オブジェクト。

注釈

TypeAttributesプロパティには、実行時に型を調査するときに使用されるSystem.Reflectionのと同じ型の値が含まれます。 これらのフラグの多くは、一部の言語の型宣言構文に対応していません。 その結果、次のフラグのみが、および に対してCodeTypeDeclarationAbstractInterfaceClassPublicNotPublicSealedNestedPublic重要になります。NestedPrivate

注意

一部のフラグ (などAbstract) は、 からCodeTypeMember継承される の プロパティ内AttributesのフラグのCodeTypeDeclaration意味と重複しています。 プロパティは Attributes 、クラスを CodeTypeDeclaration 入れ子にできるように、 から CodeTypeMember 継承するクラスの副作用です。 プロパティ内のフラグは、 TypeAttributes プロパティのフラグの代わりに使用する Attributes 必要があります。

注意

可視性フラグ (単語 Public または Nestedを含むフラグ) を設定するパターンは、 を使用して VisibilityMask すべての可視性フラグをマスクし、目的の可視性フラグを設定することです。 たとえば、 (名前付きcd) を内部クラスとして識別CodeTypeDeclarationする C# コード ステートメントは ですcd.TypeAttributes = (cd.TypeAttributes & ~TypeAttributes.VisibilityMask) | TypeAttributes.NotPublic;。 Visual Basic で同じ値を設定するコードは です cd.TypeAttributes = (cd.TypeAttributes And (TypeAttributes.VisibilityMask Xor -1)) Or TypeAttributes.NotPublic。 プロパティを TypeAttributes 可視性フラグ (cd.TypeAttributes = TypeAttributes.NotPublic;) に直接設定すると、設定できる他のすべてのフラグが消去されます。

適用対象

こちらもご覧ください