I am using an external DLL which has an abstract baseclass Packet and subclasses to Packet.
The subclasses are named after the number they represent, one name could be P132_RandomString. I am parsing a file containing these numbers and for each number I want to create a corresponding object. There are hundreds of different subclasses and the DLL have no factory method (at least not for my input).
The problem is I don't know the "RandomString" part, if I did I could have used Reflection but I assume there is no way to use Reflection since I only know the beginning of the classname?
The only solution I could think of is implementing my own factory method with hundreds of case statements but this feels a bit cumbersome...
My question is: is there a nice way to do this?