Well ofcourse, everything you can create using handtyped code and a compiler can be generated using Reflection. To create an enum you must use the DefineEnum method of a ModuleBuilder object. Here is some code to get you started.
AssemblyName an = new AssemblyName(); an.Name = "ReflectedAssembly"; an.Version = new Version(1,0,0,0); an.CultureInfo = CultureInfo.InvariantCulture; an.Flags = AssemblyNameFlags.None; // Create the assembly (.dll file) AssemblyBuilder am = AppDomain.CurrentDomain.DefineDynamicAssembly( an, AssemblyBuilderAccess.RunAndSave, @"c:\temp"); // and a module (.cs file) // Note: for the saved assembly to be one dll, // modules must share the assembly.dll file name. // Unless they will be saved in their own dll. ModuleBuilder mb = am.DefineDynamicModule( "ReflectedAssembly.dll", "ReflectedAssembly.dll", true); EnumBuilder tb = mb.DefineEnum("Refl.ReflectedEnum", TypeAttributes.Public, typeof(int)); Best regards Peter Lillevold -----Original Message----- From: Paul Stevens [mailto:[EMAIL PROTECTED]] Sent: 20. juni 2002 10:41 To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Reflection To Create Enum Is it Possible to create an enum Using Reflection? You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.