我需要一个项目的副本,但我没有找到类似Clone()
或其他的方法。这是我的代码:
private void Change(ArrayList SecuenciasIniciales, Project pj)
{
Project pjTemp = pj; //not make a copy else the same reference
for (int i = 0; i < SecuenciasIniciales.Count;i++ )
{
int[] secuencia = (int[])SecuenciasIniciales[i];
ChangeProjectTemp(secuencia,ref pjTemp,pj);
pjTemp.Application.LevelingOptions(false, true, true, PjLevelOrder.pjLevelPriority, true, Type.Missing, Type.Missing, PjLevelPeriodBasis.pjDayByDay, true, false, Type.Missing);
pjTemp.Application.LevelNow(true);
if (Directory.Exists(Server.MapPath("") + "\\sample.mpp"))
{
System.IO.File.Delete(Server.MapPath("") + "\\sample.mpp");
}
pjTemp.Application.FileSaveAs(Server.MapPath("") + "\\sample.mpp", PjFileFormat.pjMPP, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
pjTemp.Application.FileSave();
pjTemp.Application.DocClose();
pjTemp.Application.Quit(PjSaveType.pjDoNotSave);
}
}
我不想要那种pj
改变。解决办法是什么?