Tuesday, May 28, 2013

Accessing Values Using Reflection in C#

Hi Syed.Amjad,


I followed the code above. but I am getting a null reference exception.


Type _myType = assembly.GetType(classToInstantiate);

object ci = Activator.CreateInstance(_myType);

PropertyInfo prop = _myType.GetProperty("TABLE");

Array arr = (Array)prop.GetValue(ci, null);

I am getting a null value in prop.


No comments:

Post a Comment