Expand|Select|Wrap|Line Numbers
- <Students>
- <Student>
- <Name>John</Name>
- </Student>
- <Student>
- <Name>Smith</Name>
- </Student>
- </Students>
I want to declare a property from the reflected type. in other words I want to have the "Profile provider" behaviour when aquiring profile properties, a list of enumerated values appears as I add them to the web.config
I want to have my enum list like this
Students.John
----------.Smith
------------------------------- <CODE> -----------------------------------
Expand|Select|Wrap|Line Numbers
- public static Type StudentTypes
- {
- get
- {
- AppDomain currentDomain = AppDomain.CurrentDomain;
- AssemblyName aName = new AssemblyName("TempAssembly");
- AssemblyBuilder ab = currentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.RunAndSave);
- ModuleBuilder mb = ab.DefineDynamicModule(aName.Name, aName.Name + ".dll");
- EnumBuilder eb = mb.DefineEnum("StdType", TypeAttributes.Public, typeof(int));
- XmlDocument xml = new XmlDocument();
- xml.Load(HttpContext.Current.Server.MapPath("~") + ConfigurationManager.AppSettings["AdvertisesConfiguration"]);
- XmlNodeList xnList = xml.SelectNodes("/Students/Student");
- int i = 0;
- foreach (XmlNode xn in xnList)
- {
- eb.DefineLiteral(xn["Name"].InnerText, i++);
- }
- Type finished = eb.CreateType();
- return finished;
- }
- }
------- thank you