我一直在搜索,但对此没有运气,我试图从数据库中的表调用类中的方法,此方法调用另一个查找条目并填充对象的方法,但是我想将此对象传递给我的类实例
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);
之后我的对象被加载,我真的很感激这方面的任何帮助,对于糟糕的英语或者如果我没有解释清楚
精慕HU
繁华开满天机
相关分类