Dynamic factories in .net

Deeko

Lifer
Jun 16, 2000
30,213
12
81
Alright, here's what I'm trying to do.

Currently, I am using a couple of abstract factories. They're nice and all, but they pose two problems....
1. It still isn't fully dynamic. If I add a type that can be created, the factory needs to be modified as well
2. I have to have the factory class in the main project, I'd like to break it out but the objects it creates are implemented in that main project

Is there a way to make a fully dynamic factory? I'm reading in the typename as a string from a configuration file, is there a way to take that, and have a factory that attempts to spit out an object of that type?

Thanks.
 

Deeko

Lifer
Jun 16, 2000
30,213
12
81
Wow, that worked, and was a lot simpler than the solutions I was finding on Google...

thanks!