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.