I have a generic class as shown below:
using System.Collections.Generic;
namespace MyNameSpace
{
public class MyClass<T> : MyAnotherClass
{
public MyClass();
public MyClass(T obj);
public T Object { get; set; }
}
}
I don't understand why following line of code return null (throwing exception with message : "Could not load type 'MyClass' from assembly '//assembly details//' "
)
Type MyClassType = AssemblyContaingMyClass.GetType("MyNameSpace.MyClass");
Is it illegal to use Assembly.GetType(className) with generic class?
Can you suggest any alternate method to get type of generic class in run-time?
Thanks in advance and Apology if this question is too basic. I am new to c#.
EDIT :
Forgot to mention. the assembly containing MyClass will be loaded run-time.