0

I have the name of class ex:"Car" saved as string, now i want to create an instance of it! i think i have to get the type of it first, not sure!

Type.GetType() does not get the type with class name as input, even if it does how to create an instance of it next?

AliOr
  • 1
  • 1
  • Please find an example here: https://stackoverflow.com/questions/7598088/purpose-of-activator-createinstance-with-example – Markus Meyer Jan 06 '23 at 09:05
  • 2
    Does this answer your question? [Create an instance of a class from a string](https://stackoverflow.com/questions/223952/create-an-instance-of-a-class-from-a-string) – Ivan Gechev Jan 06 '23 at 09:06
  • Does this answer your question? [Instantiate C# class object using the string name](https://stackoverflow.com/questions/71626870/instantiate-c-sharp-class-object-using-the-string-name) – HarrY Jan 06 '23 at 09:52
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jan 06 '23 at 15:39

0 Answers0