Reflection help - child classes
-
I have a base class, that defines an Enum. I have one or more sub classes that redefine that Enum (using the new keyword). I am trying to write code in the base class to iterate through the enum, as defined by the subclass that is calling the code. Any ideas how? I'm trying to work my way through Reflection, and I can get all of the properties and methods, but cant get any info about any Enums that might be there. Thanks -- Dave
-
I have a base class, that defines an Enum. I have one or more sub classes that redefine that Enum (using the new keyword). I am trying to write code in the base class to iterate through the enum, as defined by the subclass that is calling the code. Any ideas how? I'm trying to work my way through Reflection, and I can get all of the properties and methods, but cant get any info about any Enums that might be there. Thanks -- Dave
In case anyone cares:
// Create a variable, but from the inherited class, not this base class Type\[\] tNested = this.GetType().GetNestedTypes(System.Reflection.BindingFlags.NonPublic); object rt = null; foreach (Type t in tNested) { rt = Activator.CreateInstance(t); break; }
-- Dave