dimanche 1 mars 2015

Using reflection to Grab NetTiers TList and then how to iterate that list

The below code works without issue, it will grab the exact TList i'm looking for. But I have no clue how to iterate it.


What i'm looking for is either how to turn my var dataTableObject into a DataTable or how to iterate the var and then use reflection to grab the specific objects i'm looking for. Meaning my TList has 100 objects, i only want 2 of the objects out of the 100 objects for all my rows.



Assembly assem = Assembly.LoadFrom(Context.Server.MapPath("~/bin/MyApp.Services.dll"));
Type typMyService = assem.GetType(string.Format(
"MyApp.Services.{0}Service", pc[i].RadComboBoxDataSourceTable), true);
object oMyService = Activator.CreateInstance(typMyService);
System.Reflection.MethodInfo objMethod = typMyService.GetMethod("GetAll", Type.EmptyTypes);
var dataTableObject = objMethod.Invoke(oMyService, null);


Thanks!






Aucun commentaire:

Enregistrer un commentaire