i have a class,
public class Test
{
public int b { get; set; }
public int c { get; set; }
public List<Doc> doc=new List<Doc>();
}
Public Class Doc
{
public int a { get; set; }
public int b { get; set; }
}
Here, i can set the value to the Test Variables like,
Test test = new Test();
string var1= "b";
PropertyInfo pi= test.GetType().GetProperty(var1);
pi.SetValue(test, Convert.ChangeType(1,pi.PropertyType), null);
so i can get test.b as 1. Likewise i need to set the value for doc. How do i achieve this. Thanks for your time.
Aucun commentaire:
Enregistrer un commentaire