lundi 26 janvier 2015

I have this function: the variable c obtains all the properties of my class <T> in this case: c ->

Id

Key

Value



public List<T> ReadStoreProceadure<T>(string storeName)
{
var result = new List<T>();
var instance = (T) Activator.CreateInstance(typeof (T), new object[] {});
var c = typeof (T);
var data = DataReader.ReadStoredProceadures(_factibilidad, storeName); // This part is returning verified data and it's ok

while (data.Read())
if (data.HasRows)
{
foreach (var item in c.GetProperties())
{
//item.SetValue(c, item.Name, null);
}
}
}


How I can add these values to my instance instance and add it to my result variable? It's possible?






Aucun commentaire:

Enregistrer un commentaire