C# TypeInfo Attributes

Description

TypeInfo Attributes Gets the attributes associated with the Type.

Syntax

TypeInfo.Attributes has the following syntax.


public TypeAttributes Attributes { get; }

Example

The following example shows the use of the Type.Attributes property.


using System;//from w  w  w . ja  va 2 s  . co  m
using System.Reflection;

public class Class1
{
    
    public static void Main()
    {
        Type t = typeof(String);
        if ((t.Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface)
            Console.WriteLine("t is an interface.");
        if ((t.Attributes & TypeAttributes.Public) != 0)
            Console.WriteLine("t is public.");
    }
}




















Home »
  C# Tutorial »
    System.Reflection »




EventInfo
FieldInfo
MemberInfo
MethodInfo
ParameterInfo
TypeInfo