Type.IsEnum : Type « System « C# / C Sharp by API






Type.IsEnum

   


using System;
using System.Collections;
using System.Reflection;

public class MainClass{
    public static void Main(){
        Assembly LoadedAsm = Assembly.LoadFrom("yourName");
        Console.WriteLine(LoadedAsm.FullName);
        Type[] LoadedTypes = LoadedAsm.GetTypes();
        if (LoadedTypes.Length == 0) {
            Console.WriteLine("No Types!");
        } else {
            foreach (Type t in LoadedTypes) {
                if (t.IsPublic) {
                    Console.WriteLine("Public ");
                } else if (t.IsNestedPublic) {
                    Console.WriteLine("Public Nested ");
                } else {
                    Console.WriteLine("Not Public ");
                }
                if (t.IsEnum) {
                    Console.WriteLine("Enum: ");
                } else if (t.IsValueType) {
                    Console.WriteLine("Struct: ");
                } else {
                    Console.WriteLine("Class: ");
                }
                Console.WriteLine("{0}", t.FullName);
            }
        }
    }
}

   
    
    
  








Related examples in the same category

1.Type.BaseType
2.Type.ContainsGenericParameters
3.Type.FullName
4.Type.GetConstructor
5.Type.GetCustomAttributes
6.Type.GetEvents()
7.Type.GetFields()
8.Type.GetGenericArguments()
9.Type.GetGenericTypeDefinition()
10.Type.GetInterfaces()
11.Type.GetMethod(String methodName);
12.Type.GetMethods()
13.Type.GetProperties()
14.Type.GetType(String typeName)
15.Type.GetType(String typeName, true)
16.Type.GetType(String typeName, true, true);
17.Type.IsAbstract
18.Type.IsClass
19.Type.IsCOMObject
20.Type.IsGenericTypeDefinition
21.Type.IsSealed
22.Type.MakeGenericType
23.Type.Name
24.Type.ReflectionOnlyGetType
25.Type.UnderlyingSystemType