Gets or sets the attributes of the type.
Assembly: System (in System.dll)
The TypeAttributes property contains the same type of values used by System.Reflection when investigating a type at run time. Many of these flags do not correspond to the type declaration syntax for some languages. As a result, only the following flags are significant to CodeTypeDeclaration : Class, Interface, Abstract, Sealed, Public, NotPublic, NestedPublic, and NestedPrivate.
Some of the flags such as Abstract overlap with the meaning of flags in the Attributes property of CodeTypeDeclaration that is inherited from CodeTypeMember. The Attributes property is a side effect of the CodeTypeDeclaration class inheriting from CodeTypeMember so that classes can be nested. The flags in the property should be used instead of the flags in the Attributes property.
The pattern for setting the visibility flags (flags containing the words Public or Nested) is to mask out all visibility flags using the VisibilityMask and then set the desired visibility flag. For example, the C# code statement to identify the CodeTypeDeclaration (named cd) as an internal class is cd.TypeAttributes = (cd.TypeAttributes & ~TypeAttributes.VisibilityMask) | TypeAttributes.NotPublic;. The code to set the same value in Visual Basic is cd.TypeAttributes = (cd.TypeAttributes And (TypeAttributes.VisibilityMask Xor -1)) Or TypeAttributes.NotPublic. Setting the property directly to a visibility flag (cd.TypeAttributes = TypeAttributes.NotPublic;) erases all other flags that might be set.
Available since 1.1