Type::Attributes Property

 

Gets the attributes associated with the Type.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public:
property TypeAttributes Attributes {
	virtual TypeAttributes get() sealed;
}

Property Value

Type: System.Reflection::TypeAttributes

A TypeAttributes object representing the attribute set of the Type, unless the Type represents a generic type parameter, in which case the value is unspecified.

Some members of the TypeAttributes enumeration are masks that represent a group of values. Each group includes one member whose underlying value is zero. For example, the underlying value of the TypeAttributes::NotPublic member in the TypeAttributes::VisibilityMask group is zero, as is the TypeAttributes::AutoLayout member in the TypeAttributes::SequentialLayout group. Because of this, you must use the mask before testing for those values. The example provides an illustration.

System_CAPS_tipTip

For most purposes, properties likeIsClass,IsAutoLayout, andIsSpecialName are easier to use than type attributes.

If the current Type represents a constructed generic type, this property returns the attributes of the generic type definition. For example, the attributes returned for MyGenericClass<int> (MyGenericClass(Of Integer) in Visual Basic) are the attributes of MyGenericClass<T> (MyGenericClass(Of T) in Visual Basic).

If the current Type represents a generic type parameter — that is, if the IsGenericParameter property returns true — the TypeAttributes value returned by this property is unspecified.

The following example usesthe Attributes property.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: