C# Type Attributes

Description

Type Attributes gets the attributes associated with the Type.

Syntax

Type.Attributes has the following syntax.


public TypeAttributes Attributes { get; }

Example

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


//from w ww .  j  a v a2  s . co  m
using System;
using System.Reflection;

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

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version