的方法我试图使用反射代码,因为我想要它管理技术人员和其他类型。使用反射我需要调用(T)参数
m_Technician = m_Entities.CreateObject(Of Technician)() 'line#1
m_Technician.IDTechnician = Guid.NewGuid()
m_Entities.AddObject("Technicians", m_Technician)
我用这个代码和反射来填充实体,它完美的工作。
m_Entity = GetType(RFOPSEntities). _
GetMethod(FillMethodName).Invoke(m_Entities, New Object() {uniqueKey})
所以,我想1类似的东西的行号:
m_Entity = GetType(RFOPSEntities). _
GetMethod("CreateObject"). _
Invoke(m_Entities, New Object({GetType("Technician")})
我觉得我的困难是要通过(Of Technician)
谢谢
可能重复[如何使用反射来调用泛型方法?(http://stackoverflow.com/questions/232535/how-to-use-reflection-to-call-generic-method) – usr 2014-05-30 17:10:03