I dont think you posted all the code. I suspect you added dimTemp to the list. So the last item in the list is dimTemp and updating the item in the list will make it to the variable. Add a clone of dimTemp to the list if you do not want the dimTemp variable to update.
class ClassM:ICloneable
{
public int value { get; set; }
public object Clone()
{
return new ClassM()
{
value = this.value
};
}
}
ClassM dimTemp;
List<ClassM> lstData = new List<ClassM>();
dimTemp = new ClassM();
dimTemp.value = 1;
lstData.Add((ClassM)dimTemp.Clone());
Console.WriteLine(dimTemp.value);
lstData.LastOrDefault().value = dimTemp.value + lstData.LastOrDefault().value;