Can I use a class as an object in .NET to create instances of that class?
- by Troy
I'm writing a fairly uncomplicated program which can "connect" to several different types of data sources including text files and various databases. I've decided to implement each of these connection types as a class inherited from an interface I called iConnection. So, for example, I have TextConnection, MySQLConnection, &c... as classes.
In another static class I've got a dictionary with human-readable names for these connections as keys. For the value of each dictionary entry, I want the class itself. That way, I can do things like:
newConnection = new dict[connectionTypeString]();
Is there a way to do something like this? I'm fairly new to C# so I'd appreciate any help.