Tuesday, April 21, 2020

Constructor on type 'meh' not found.

This stems from using System.Activator.CreateInstance which can just pick the wrong constructor for a class. Tricky stuff! Remember if you want to call a type with three parameters at the constructor that you must pass four constructors to the CreateInstance and the CreateInstance will use the first as the type to create. Also, if there are many constructors, the constructor with the most variables wins!

No comments:

Post a Comment