I have seen examples on how to convert string to class type, but I was unable to apply the same logic to a class that has a constructor, which itself takes a string as a parameter. This is what I have seen on other posts.
Type type = Type.GetType("classNameAsString");
object instance = Activator.CreateInstance(type);
What I want to do is to apply the same to this case
public class ExampleClass
{
public ExampleClass(string strParameter)
{
}
}
I would normally instantiate ExampleClass as
var exClassInst = new ExampleClass("stringParam");
How can I achieve the same, but first converting "ExampleClass" string to type and then instantiating it. Thank you for your help.