I'm having difficulty with a dictionary that I want to compare an updated version to the original version.
The first method passes in the dictionary, then from there it gets passed to a static helper class that updates that dictionary.
Before I pass the original dictionary to the helper class, I want to make a copy of the original dictionary so I can compare.
This is where I'm having trouble. After the helper class, the 'copy' of the dictionary has been updated too.
I've even tried making a struct that contains a dictionary thinking that'd copy the original dictionary values, but that seems to be by ref too! Here is a snippet of the code.
public PartialViewResult updateItem(string submit, FormCollection Collection)
{
SurveyItem UpdatedItem = new SurveyItem();
ItemSettingsCopy OriginalSettings;
ItemBank CurrentSurvey = (ItemBank)Session["Survey"];
string _itemName = (string)Session["CurrentItem"];
OriginalSettings.ItemSettings = CurrentSurvey[_itemName].ItemSettings;
//this is where I'm trying to make a copy of the original settings.
UpdatedItem = BankManagerHelper.UpdateItem(CurrentSurvey[_itemName], Collection, submit); //static item now updates the fields in the item
//AT THIS POINT OriginalSettings.ItemSettings HAS BEEN CHANGED TOO