使用Type C类动态转换#

时间:2017-08-03 12:59:11

标签: c# .net reflection

我有一个类型和对象,我需要将该对象转换为该类型。这是我的示例代码:

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;
}

0 个答案:

没有答案