Sorry, for the somewhat confusing subject, but my problem is equally
odd (imo).
So, I have an assembly that contains an abstract class (File) and 5
other classes that all subclass it (Exe, Dll, Txt, Config, Sql). I'm
able to do the Assembly.GetTypes() thing and figure out which classes
are subclasses of File, but I need to be able to create instances of
them.
Is there a way I can do something like:
string filename = "foo.sql";
ArrayList types = new ArrayList();
foreach(Type t in Assembly.GetTypes())
{
if(t.IsSubclassOf(typeof(File)))
{
// create an instance of the class T
if(instance.Ext = ".sql")
return instance;
}
}
I hope I'm being clear.
I've pasted all of the code that creates the abstract class and
subclasses here:
http://pastebin.com/427380
Any suggestions?