jeudi 3 août 2017

dynamic convert using Type Class C#

I have a type and object and I need to convert that object to that type. Here is my sample code:

foreach (object o in eTable)
{
     var type = (typeof(ERPEntities).GetProperty(TableName).PropertyType);
     // this is the static conversion but i need the dynamic one to generalize the code
     var dasd = o as GN_Nationalities;
}





Aucun commentaire:

Enregistrer un commentaire