Assuming I have an Object ItemVO in which there a bunch of properties already assigned. eg:
ItemVO originalItemVO = new ItemVO();
originalItemVO.ItemId = 1;
originalItemVO.ItemCategory = "ORIGINAL";
I would like to create another duplicate by using :
duplicateItemVO = originalItemVO;
and then use the duplicateItemVO and alter its' properties, WITHOUT changing the originalItemVO:
// This also change the originalItemVO.ItemCategory which I do not want.
duplicateItemVO.ItemCategory = "DUPLICATE"
How can I achieve this, without changing the class ItemVO ?
Thanks
public class ItemVO
{
public ItemVO()
{
ItemId = "";
ItemCategory = "";
}
public string ItemId { get; set; }
public string ItemCategory { get; set; }
}