Mega Code Archive

 
Categories / C# / Reflection
 

Gets the attributes associated with the Type

using System; using System.Reflection; public class Class1 {     public void Method1()     {         Type t = typeof(System.Array);         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()     {     } }