【发布时间】:2018-12-23 11:26:16
【问题描述】:
我一直在搜索,但没有运气,我试图从数据库中的表中调用类中的方法,此方法调用另一个查找条目并填充对象的方法,但是我想将此对象传递给我的实例类的
public class ProductCategory
{
public int ProductCategoryID { get; set; }
public string Name { get; set; }
public Guid rowguid { get; set; }
public DateTime ModifiedDate { get; set; }
public void FindItem<T1>(T1 id)
{
try
{
var obj = Activator.CreateInstance(this.GetType());
obj = Dal.ObjFind(obj, id); //this fill the object
//i want something like
foreach properties in obj
this.propertie = obj.propertie
}
catch (Exception e)
{
throw e;
}
}
}
以一种我可以调用该方法的方式
ProductCategory test = new ProductCategory();
test.Find(1);
然后我的对象被加载,我真的很感激任何帮助,对不起英语不好或者我解释不清楚
问候
【问题讨论】: