I'm currently dealing with a requirement to a pass Class to a GenericMethod as T. But I get my className as string parameter. When I know the className at Compile time, I have no issue. But I'm struck passing the className as T to the GenericMethod when I receive the className in string parameter..
How can I pass the className as a Class to the GenericMethod ChildClass_1: ParentClass
public override void CallGenericMethod(string currentClassName)
{
var type = Type.GetType(currentClassName);
GenericMethod<type>(typeOf(type).Name);
}
ParentClass.cs
public virtual void GenericMethod<type>(string className){
console.WriteLine("Invoked ClassName");
}
Could anyone please help me in resolving this problem. Thanks in advance