Consider following line of code :
classA<classB> C;
I want to create instance of C during run-time by using System.Reflection instead. For that I will need to know Type of classA and classB during run-time.
I know how to get type of classB
Type classBType = AssemblyContaingClassB.GetType("namespace.classB");
Q1> How can I use this classBType to get type of classA ?
Q2> I understand that to create instance in run-time, we call following line of code:
object C = Activator.CreateInstance(TypeName);
To create instance of C, What TypeName should above code use? will Type of classA sufficient to create this instance
Thanks in advance and Apology if this question is too basic. I am new to c#.
EDIT:
The problem is Fixed. From p.s.w.g's answer, there was problem in getting type of class with generic parameter. The solution on how to get type of generic parameter can be found here. After that I just did what p.s.w.g's answer suggest and its work.