new Foo(); or Activator.CreateInstance(); ?

I'm watching Microsoft Virtual Academy's series "Programming in C# Jump Start", and this way of creating an instance of a class is shown – without really explaining when to use it. So, I turn to Reddit. Is there an easy way to demonstrate why (if ever) ..

Foo x = new Foo(); // .. is preferred over Foo x = Activator.CreateInstance<Foo>(); // .. ? 

Thanks in advance! I hope that made some sense.

by fanfarius via /r/csharp

Leave a Reply