/// <summary>
/// 克隆方法
/// </summary>
/// <returns></returns>
public object Clone()
{
try
{
Type type = this.GetType();
VoucherDTO vd = (VoucherDTO)Activator.CreateInstance(type);
PropertyInfo[] pilist = type.GetProperties();
foreach (PropertyInfo item in pilist)
{
PropertyInfo pi = this.GetType().GetProperty(item.Name);
if (pi != null)
{
object value = pi.GetValue(this, null);
item.SetValue(vd, value, null);
}
}
vd.Details = new List<VoucherDTO>();
return vd;
}
catch (Exception ex)
{
throw new Exception("克隆方法出现异常!", ex);
}
}
/// 克隆方法
/// </summary>
/// <returns></returns>
public object Clone()
{
try
{
Type type = this.GetType();
VoucherDTO vd = (VoucherDTO)Activator.CreateInstance(type);
PropertyInfo[] pilist = type.GetProperties();
foreach (PropertyInfo item in pilist)
{
PropertyInfo pi = this.GetType().GetProperty(item.Name);
if (pi != null)
{
object value = pi.GetValue(this, null);
item.SetValue(vd, value, null);
}
}
vd.Details = new List<VoucherDTO>();
return vd;
}
catch (Exception ex)
{
throw new Exception("克隆方法出现异常!", ex);
}
}