Answer the question
In order to leave comments, you need to log in
How to create an object in c# depending on the type?
Let me have some object Type t. Also, there are a number of classes with a common interface (let the classes be called A, B, and the interface - AB). They have constructors that take the same parameters as an argument. How can you create an object of the desired type depending on t? I don’t want to use switch / if and the like, because there can be at least 50 such classes.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question